Commit 892f6ebc authored by Jules Maselbas's avatar Jules Maselbas Committed by Greg Kroah-Hartman

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: 721fdc83 ("usb: max3421: Add devicetree support")
Signed-off-by: default avatarJules Maselbas <jules.maselbas@grenoble-inp.org>
Reported-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4756f35f
...@@ -1699,13 +1699,9 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index, ...@@ -1699,13 +1699,9 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index,
unsigned long flags; unsigned long flags;
int retval = 0; int retval = 0;
spin_lock_irqsave(&max3421_hcd->lock, flags);
pdata = spi->dev.platform_data; pdata = spi->dev.platform_data;
if (!pdata) {
dev_err(&spi->dev, "Device platform data is missing\n"); spin_lock_irqsave(&max3421_hcd->lock, flags);
return -EFAULT;
}
switch (type_req) { switch (type_req) {
case ClearHubFeature: case ClearHubFeature:
...@@ -1882,7 +1878,6 @@ max3421_probe(struct spi_device *spi) ...@@ -1882,7 +1878,6 @@ max3421_probe(struct spi_device *spi)
if (IS_ENABLED(CONFIG_OF) && dev->of_node) { if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
pdata = devm_kzalloc(&spi->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&spi->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata) {
dev_err(&spi->dev, "failed to allocate memory for private data\n");
retval = -ENOMEM; retval = -ENOMEM;
goto error; goto error;
} }
...@@ -1995,12 +1990,6 @@ max3421_remove(struct spi_device *spi) ...@@ -1995,12 +1990,6 @@ max3421_remove(struct spi_device *spi)
spin_unlock_irqrestore(&max3421_hcd->lock, flags); 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); free_irq(spi->irq, hcd);
usb_put_hcd(hcd); usb_put_hcd(hcd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment