Re: [PATCH] USB: chipidea: fix error path

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

 



On Thu, Dec 19, 2013 at 09:35:44AM +0100, Sascha Hauer wrote:
> devm_usb_get_phy_by_phandle() returns a PTR_ERR on failure, so we have
> to check for IS_ERR before calling usb_phy_shutdown(), not for NULL.
> 
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> Cc: Peter Chen <peter.chen@xxxxxxxxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> ---
>  drivers/usb/chipidea/ci_hdrc_imx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index be822a2..1b7ffc9 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -165,7 +165,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
>  disable_device:
>  	ci_hdrc_remove_device(data->ci_pdev);
>  err_phy:
> -	if (data->phy)
> +	if (!IS_ERR(data->phy))
>  		usb_phy_shutdown(data->phy);
>  err_clk:
>  	clk_disable_unprepare(data->clk);
> @@ -179,7 +179,7 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev)
>  	pm_runtime_disable(&pdev->dev);
>  	ci_hdrc_remove_device(data->ci_pdev);
>  
> -	if (data->phy)
> +	if (!IS_ERR(data->phy))
>  		usb_phy_shutdown(data->phy);
>  
>  	clk_disable_unprepare(data->clk);
> -- 
> 1.8.5.1
> 

Sascha, thanks for your patch.

We have already moved PHY operation from glue layer to core, this
patch may not be needed.

https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-linus&id=74475ede784d4a649592751e4d85bb8ff679e1e0
https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-linus&id=af59a8b120d18949f4f9166ccbe17348e3c9cd96

-- 

Best Regards,
Peter Chen

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux