2017-04-17 03:11:12

by Stefan Agner

[permalink] [raw]
Subject: [PATCH] usb: gadget: remove redundant self assignment

The assignment ret = ret is redundant and can be removed.

Signed-off-by: Stefan Agner <[email protected]>
---
A very similar patch has been applied already last year, but there is
a second such assignment...

--
Stefan

drivers/usb/gadget/udc/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index d685d82dcf48..b57bd53812fe 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -139,10 +139,8 @@ int usb_ep_disable(struct usb_ep *ep)
goto out;

ret = ep->ops->disable(ep);
- if (ret) {
- ret = ret;
+ if (ret)
goto out;
- }

ep->enabled = false;

--
2.12.2


2017-04-17 07:43:02

by Peter Chen

[permalink] [raw]
Subject: Re: [PATCH] usb: gadget: remove redundant self assignment

On Sun, Apr 16, 2017 at 08:12:50PM -0700, Stefan Agner wrote:
> The assignment ret = ret is redundant and can be removed.
>
> Signed-off-by: Stefan Agner <[email protected]>
> ---
> A very similar patch has been applied already last year, but there is
> a second such assignment...
>
> --
> Stefan
>
> drivers/usb/gadget/udc/core.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index d685d82dcf48..b57bd53812fe 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -139,10 +139,8 @@ int usb_ep_disable(struct usb_ep *ep)
> goto out;
>
> ret = ep->ops->disable(ep);
> - if (ret) {
> - ret = ret;
> + if (ret)
> goto out;
> - }
>
> ep->enabled = false;
>

Reviewed-by: Peter Chen <[email protected]>

--

Best Regards,
Peter Chen

2017-04-19 09:01:12

by Krzysztof Opasiak

[permalink] [raw]
Subject: Re: [PATCH] usb: gadget: remove redundant self assignment



On 04/17/2017 05:12 AM, Stefan Agner wrote:
> The assignment ret = ret is redundant and can be removed.
>
> Signed-off-by: Stefan Agner <[email protected]>
> ---
> A very similar patch has been applied already last year, but there is
> a second such assignment...
>
> --
> Stefan
>
> drivers/usb/gadget/udc/core.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index d685d82dcf48..b57bd53812fe 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -139,10 +139,8 @@ int usb_ep_disable(struct usb_ep *ep)
> goto out;
>
> ret = ep->ops->disable(ep);
> - if (ret) {
> - ret = ret;
> + if (ret)
> goto out;
> - }
>
> ep->enabled = false;
>
>

Reviewed-by: Krzysztof Opasiak <[email protected]>

--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics