lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Tue, 31 Oct 2017 11:40:33 +0100
From:   Jules Maselbas <jules.maselbas@...noble-inp.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Rob Herring <robh@...nel.org>, Julia Lawall <Julia.Lawall@...6.fr>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        linux-usb <linux-usb@...r.kernel.org>,
        linux-kernel@...r.kernel.org,
        Jules Maselbas <jules.maselbas@...noble-inp.org>
Subject: [PATCH] usb: host: max3421-hcd: Remove pdata test in max3421_hub_control()

We do not have to test if platform_data pointer is null in
max3421_hub_control(), as the driver probe will fail if no
platform_data is found.

Fixes: 721fdc83b31b ("usb: max3421: Add devicetree support")
Signed-off-by: Jules Maselbas <jules.maselbas@...noble-inp.org>
Reported-by: Julia Lawall <julia.lawall@...6.fr>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
---
 drivers/usb/host/max3421-hcd.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index 928a5aabee02..02bbf8938bb9 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -1699,13 +1699,9 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index,
 	unsigned long flags;
 	int retval = 0;
 
-	spin_lock_irqsave(&max3421_hcd->lock, flags);
-
 	pdata = spi->dev.platform_data;
-	if (!pdata) {
-		dev_err(&spi->dev, "Device platform data is missing\n");
-		return -EFAULT;
-	}
+
+	spin_lock_irqsave(&max3421_hcd->lock, flags);
 
 	switch (type_req) {
 	case ClearHubFeature:
@@ -1882,7 +1878,6 @@ max3421_probe(struct spi_device *spi)
 	if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
 		pdata = devm_kzalloc(&spi->dev, sizeof(*pdata), GFP_KERNEL);
 		if (!pdata) {
-			dev_err(&spi->dev, "failed to allocate memory for private data\n");
 			retval = -ENOMEM;
 			goto error;
 		}
@@ -1995,12 +1990,6 @@ max3421_remove(struct spi_device *spi)
 
 	spin_unlock_irqrestore(&max3421_hcd->lock, flags);
 
-	if (IS_ENABLED(CONFIG_OF) && spi->dev.platform_data) {
-		dev_dbg(&spi->dev, "Freeing platform data structure\n");
-		devm_kfree(&spi->dev, spi->dev.platform_data);
-		spi->dev.platform_data = NULL;
-	}
-
 	free_irq(spi->irq, hcd);
 
 	usb_put_hcd(hcd);
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ