Re: [PATCH] usb: max3421: unlock on error in max3421_hub_control()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> We can't return directly in max3421_hub_control(), we have to unlock
> first.
Yes you are right.
I think testing if pdata is null is not necessary as driver_probe will fail if
the device do not have a platform_data.

Jules.

> Fixes: 721fdc83b31b ("usb: max3421: Add devicetree support")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
> index 928a5aabee02..46a86a7f3360 100644
> --- a/drivers/usb/host/max3421-hcd.c
> +++ b/drivers/usb/host/max3421-hcd.c
> @@ -1704,7 +1704,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16
> value, u16 index,
> 	pdata = spi->dev.platform_data;
> 	if (!pdata) {
> 		dev_err(&spi->dev, "Device platform data is missing\n");
> -		return -EFAULT;
> +		retval = -EFAULT;
> +		goto unlock;
> 	}
> 
> 	switch (type_req) {
> @@ -1787,6 +1788,7 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16
> value, u16 index,
> 		retval = -EPIPE;
> 	}
> 
> +unlock:
> 	spin_unlock_irqrestore(&max3421_hcd->lock, flags);
> 	return retval;
>  }
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux