linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2]usb: gadget: bcm63xx_udc:remove redundant variable assignment
@ 2020-03-24 13:20 Tang Bin
  2020-03-24 14:50 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Tang Bin @ 2020-03-24 13:20 UTC (permalink / raw)
  To: cernekee, balbi, gregkh, sergei.shtylyov
  Cc: f.fainelli, bcm-kernel-feedback-list, linux-usb,
	linux-arm-kernel, linux-kernel, Tang Bin

--v1------------------------------------
In this function, the variable 'rc' is assigned after this place,
so the definition is invalid.

--v2------------------------------------
In this function, the variable 'rc' will be assigned by the function
'usb_add_gadget_udc()',so the assignment here is redundant,we should
remove it.

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/usb/gadget/udc/bcm63xx_udc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c
index 54501814d..a7afa8c35 100644
--- a/drivers/usb/gadget/udc/bcm63xx_udc.c
+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
@@ -2321,8 +2321,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
 	if (rc)
 		return rc;
 
-	rc = -ENXIO;
-
 	/* IRQ resource #0: control interrupt (VBUS, speed, etc.) */
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-- 
2.20.1.windows.1




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

* Re: [PATCH v2]usb: gadget: bcm63xx_udc:remove redundant variable assignment
  2020-03-24 13:20 [PATCH v2]usb: gadget: bcm63xx_udc:remove redundant variable assignment Tang Bin
@ 2020-03-24 14:50 ` Sergei Shtylyov
  2020-03-24 14:55   ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2020-03-24 14:50 UTC (permalink / raw)
  To: Tang Bin, cernekee, balbi, gregkh
  Cc: f.fainelli, bcm-kernel-feedback-list, linux-usb,
	linux-arm-kernel, linux-kernel

Hello!

On 03/24/2020 04:20 PM, Tang Bin wrote:

> --v1------------------------------------
> In this function, the variable 'rc' is assigned after this place,
> so the definition is invalid.
> 
> --v2------------------------------------
> In this function, the variable 'rc' will be assigned by the function
> 'usb_add_gadget_udc()',so the assignment here is redundant,we should
> remove it.
> 
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

   NAK.

> ---
>  drivers/usb/gadget/udc/bcm63xx_udc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c
> index 54501814d..a7afa8c35 100644
> --- a/drivers/usb/gadget/udc/bcm63xx_udc.c
> +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
> @@ -2321,8 +2321,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
>  	if (rc)
>  		return rc;
>  
> -	rc = -ENXIO;
> -
>  	/* IRQ resource #0: control interrupt (VBUS, speed, etc.) */
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)

   This *if* branch goes to the 'out_uninit' label which uses 'rc' (and it should
be negative).
   In principle, if you change 'rc' to 'irq' below, this patch would be sane.
It's not as is.

MBR, Sergei

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

* Re: [PATCH v2]usb: gadget: bcm63xx_udc:remove redundant variable assignment
  2020-03-24 14:50 ` Sergei Shtylyov
@ 2020-03-24 14:55   ` Sergei Shtylyov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2020-03-24 14:55 UTC (permalink / raw)
  To: Tang Bin, cernekee, balbi, gregkh
  Cc: f.fainelli, bcm-kernel-feedback-list, linux-usb,
	linux-arm-kernel, linux-kernel

On 03/24/2020 05:50 PM, Sergei Shtylyov wrote:

>> --v1------------------------------------
>> In this function, the variable 'rc' is assigned after this place,
>> so the definition is invalid.
>>
>> --v2------------------------------------
>> In this function, the variable 'rc' will be assigned by the function
>> 'usb_add_gadget_udc()',so the assignment here is redundant,we should
>> remove it.
>>
>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> 
>    NAK.
> 
>> ---
>>  drivers/usb/gadget/udc/bcm63xx_udc.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c
>> index 54501814d..a7afa8c35 100644
>> --- a/drivers/usb/gadget/udc/bcm63xx_udc.c
>> +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
>> @@ -2321,8 +2321,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
>>  	if (rc)
>>  		return rc;
>>  
>> -	rc = -ENXIO;
>> -
>>  	/* IRQ resource #0: control interrupt (VBUS, speed, etc.) */
>>  	irq = platform_get_irq(pdev, 0);
>>  	if (irq < 0)
> 
>    This *if* branch goes to the 'out_uninit' label which uses 'rc' (and it should
> be negative).
>    In principle, if you change 'rc' to 'irq' below, this patch would be sane.
> It's not as is.

   Still, the other *goto* out_uninit in te loop below shoild be changed as well.
Otherwise, if the result is overriden to -ENXIO, e.g. deferred probing is borked.

MBR, Sergei

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

end of thread, other threads:[~2020-03-24 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 13:20 [PATCH v2]usb: gadget: bcm63xx_udc:remove redundant variable assignment Tang Bin
2020-03-24 14:50 ` Sergei Shtylyov
2020-03-24 14:55   ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).