lkml.org 
[lkml]   [2021]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/6] usb: chipidea: core: Add return value function check
On 21-08-24 22:46:17, Manish Narani wrote:
> From: Piyush Mehta <piyush.mehta@xilinx.com>
>
> Add return value validation for function phy exit and phy power off.
>
> Addresses-Coverity: "USELESS_CALL"
> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> Signed-off-by: Manish Narani <manish.narani@xilinx.com>
> ---
> drivers/usb/chipidea/core.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 676346f..37f619e 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -324,7 +324,8 @@ static int _ci_usb_phy_init(struct ci_hdrc *ci)
>
> ret = phy_power_on(ci->phy);
> if (ret) {
> - phy_exit(ci->phy);
> + if (phy_exit(ci->phy) < 0)
> + dev_dbg(ci->dev, "phy exit failed\r\n");

You may not need to debug message, the phy_exit shows error message.
You may return 'ret' for phy_exit for error.

> return ret;
> }
> } else {
> @@ -341,12 +342,20 @@ static int _ci_usb_phy_init(struct ci_hdrc *ci)
> */
> static void ci_usb_phy_exit(struct ci_hdrc *ci)
> {
> + int ret;
> +
> if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
> return;
>
> if (ci->phy) {
> - phy_power_off(ci->phy);
> - phy_exit(ci->phy);
> + ret = phy_power_off(ci->phy);
> + if (ret < 0)
> + dev_dbg(ci->dev, "phy poweroff failed\r\n");
> +
> + ret = phy_exit(ci->phy);
> + if (ret < 0)
> + dev_dbg(ci->dev, "phy exit failed\r\n");
> +

Ditto

> } else {
> usb_phy_shutdown(ci->usb_phy);
> }
> --
> 2.1.1
>

--

Thanks,
Peter Chen

\
 
 \ /
  Last update: 2021-10-07 07:01    [W:0.031 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site