public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] usb: dwc3: gadget: remove redundant ret variable in dwc3_gadget_vbus_draw
@ 2022-11-17  1:53 guo.ziliang
  2022-11-18  0:40 ` Thinh Nguyen
  0 siblings, 1 reply; 2+ messages in thread
From: guo.ziliang @ 2022-11-17  1:53 UTC (permalink / raw)
  To: thinh.nguyen; +Cc: linux-usb, linux-kernel, guo.ziliang

From: guo ziliang <guo.ziliang@zte.com.cn>
Return value from dwc3_gadget_vbus_draw() directly instead of taking
this in another redundant variable.

Signed-off-by: guo ziliang <guo.ziliang@zte.com.cn>
---
 drivers/usb/dwc3/gadget.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index faf37c6..d984d68 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2904,7 +2904,6 @@ static int dwc3_gadget_vbus_draw(struct usb_gadget *g, unsigned int mA)
 {
        struct dwc3             *dwc = gadget_to_dwc(g);
        union power_supply_propval      val = {0};
-       int                             ret;

        if (dwc->usb2_phy)
                return usb_phy_set_power(dwc->usb2_phy, mA);
@@ -2913,9 +2912,7 @@ static int dwc3_gadget_vbus_draw(struct usb_gadget *g, unsigned int mA)
                return -EOPNOTSUPP;

        val.intval = 1000 * mA;
-       ret = power_supply_set_property(dwc->usb_psy, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &val);
-
-       return ret;
+       return power_supply_set_property(dwc->usb_psy, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &val);
 }

 /**
--
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next] usb: dwc3: gadget: remove redundant ret variable in dwc3_gadget_vbus_draw
  2022-11-17  1:53 [PATCH linux-next] usb: dwc3: gadget: remove redundant ret variable in dwc3_gadget_vbus_draw guo.ziliang
@ 2022-11-18  0:40 ` Thinh Nguyen
  0 siblings, 0 replies; 2+ messages in thread
From: Thinh Nguyen @ 2022-11-18  0:40 UTC (permalink / raw)
  To: guo.ziliang@zte.com.cn
  Cc: Thinh Nguyen, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Thu, Nov 17, 2022, guo.ziliang@zte.com.cn wrote:
> From: guo ziliang <guo.ziliang@zte.com.cn>

Add new line here.

> Return value from dwc3_gadget_vbus_draw() directly instead of taking
> this in another redundant variable.
> 
> Signed-off-by: guo ziliang <guo.ziliang@zte.com.cn>
> ---
>  drivers/usb/dwc3/gadget.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index faf37c6..d984d68 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2904,7 +2904,6 @@ static int dwc3_gadget_vbus_draw(struct usb_gadget *g, unsigned int mA)
>  {
>         struct dwc3             *dwc = gadget_to_dwc(g);
>         union power_supply_propval      val = {0};
> -       int                             ret;
> 
>         if (dwc->usb2_phy)
>                 return usb_phy_set_power(dwc->usb2_phy, mA);
> @@ -2913,9 +2912,7 @@ static int dwc3_gadget_vbus_draw(struct usb_gadget *g, unsigned int mA)
>                 return -EOPNOTSUPP;
> 
>         val.intval = 1000 * mA;
> -       ret = power_supply_set_property(dwc->usb_psy, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &val);
> -
> -       return ret;
> +       return power_supply_set_property(dwc->usb_psy, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &val);
>  }
> 
>  /**
> --
> 1.8.3.1

Looks like the patch is corrupted.

Regardless, I think it's fine as is without this change.

BR,
Thinh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-18  0:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17  1:53 [PATCH linux-next] usb: dwc3: gadget: remove redundant ret variable in dwc3_gadget_vbus_draw guo.ziliang
2022-11-18  0:40 ` Thinh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox