All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFC: microread: Pass err variable to async_cb()
@ 2021-06-01 13:00 Nigel Christian
  2021-06-01 13:07   ` [linux-nfc] " Krzysztof Kozlowski
  2021-06-01 13:37 ` Dan Carpenter
  0 siblings, 2 replies; 6+ messages in thread
From: Nigel Christian @ 2021-06-01 13:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: linux-nfc, netdev, kernel-janitors

In the case MICROREAD_CB_TYPE_READER_ALL clang reports a dead
code warning. The error code is being directly passed to 
async_cb(). Fix this by passing the err variable, which is also
done in another path.

Addresses-Coverity: ("Unused value") 
Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
---
 drivers/nfc/microread/microread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
index 8d3988457c58..130b0f554016 100644
--- a/drivers/nfc/microread/microread.c
+++ b/drivers/nfc/microread/microread.c
@@ -367,7 +367,7 @@ static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
 				err = -EPROTO;
 				kfree_skb(skb);
 				info->async_cb(info->async_cb_context, NULL,
-					       -EPROTO);
+					       err);
 				return;
 			}
 
-- 
2.31.1


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

* Re: [PATCH] NFC: microread: Pass err variable to async_cb()
  2021-06-01 13:00 [PATCH] NFC: microread: Pass err variable to async_cb() Nigel Christian
  2021-06-01 13:07   ` [linux-nfc] " Krzysztof Kozlowski
@ 2021-06-01 13:07   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-01 13:07 UTC (permalink / raw)
  To: Nigel Christian; +Cc: linux-nfc, netdev, kernel-janitors

On 01/06/2021 15:00, Nigel Christian wrote:
> In the case MICROREAD_CB_TYPE_READER_ALL clang reports a dead
> code warning. The error code is being directly passed to 
> async_cb(). Fix this by passing the err variable, which is also
> done in another path.
> 
> Addresses-Coverity: ("Unused value") 
> Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
> ---
>  drivers/nfc/microread/microread.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
> index 8d3988457c58..130b0f554016 100644
> --- a/drivers/nfc/microread/microread.c
> +++ b/drivers/nfc/microread/microread.c
> @@ -367,7 +367,7 @@ static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
>  				err = -EPROTO;

Remove this line instead, please. The err is argument passed by value so
assigning it within a function is ugly.

>  				kfree_skb(skb);
>  				info->async_cb(info->async_cb_context, NULL,
> -					       -EPROTO);
> +					       err);
>  				return;
>  			}
>  
> 


Best regards,
Krzysztof

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

* [linux-nfc] Re: [PATCH] NFC: microread: Pass err variable to async_cb()
@ 2021-06-01 13:07   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-01 13:07 UTC (permalink / raw)
  To: Nigel Christian; +Cc: linux-nfc, netdev, kernel-janitors

On 01/06/2021 15:00, Nigel Christian wrote:
> In the case MICROREAD_CB_TYPE_READER_ALL clang reports a dead
> code warning. The error code is being directly passed to 
> async_cb(). Fix this by passing the err variable, which is also
> done in another path.
> 
> Addresses-Coverity: ("Unused value") 
> Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
> ---
>  drivers/nfc/microread/microread.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
> index 8d3988457c58..130b0f554016 100644
> --- a/drivers/nfc/microread/microread.c
> +++ b/drivers/nfc/microread/microread.c
> @@ -367,7 +367,7 @@ static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
>  				err = -EPROTO;

Remove this line instead, please. The err is argument passed by value so
assigning it within a function is ugly.

>  				kfree_skb(skb);
>  				info->async_cb(info->async_cb_context, NULL,
> -					       -EPROTO);
> +					       err);
>  				return;
>  			}
>  
> 


Best regards,
Krzysztof
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

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

* Re: [PATCH] NFC: microread: Pass err variable to async_cb()
@ 2021-06-01 13:07   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-01 13:07 UTC (permalink / raw)
  To: linux-nfc

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]

On 01/06/2021 15:00, Nigel Christian wrote:
> In the case MICROREAD_CB_TYPE_READER_ALL clang reports a dead
> code warning. The error code is being directly passed to 
> async_cb(). Fix this by passing the err variable, which is also
> done in another path.
> 
> Addresses-Coverity: ("Unused value") 
> Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
> ---
>  drivers/nfc/microread/microread.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
> index 8d3988457c58..130b0f554016 100644
> --- a/drivers/nfc/microread/microread.c
> +++ b/drivers/nfc/microread/microread.c
> @@ -367,7 +367,7 @@ static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
>  				err = -EPROTO;

Remove this line instead, please. The err is argument passed by value so
assigning it within a function is ugly.

>  				kfree_skb(skb);
>  				info->async_cb(info->async_cb_context, NULL,
> -					       -EPROTO);
> +					       err);
>  				return;
>  			}
>  
> 


Best regards,
Krzysztof

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

* Re: [PATCH] NFC: microread: Pass err variable to async_cb()
  2021-06-01 13:00 [PATCH] NFC: microread: Pass err variable to async_cb() Nigel Christian
  2021-06-01 13:07   ` [linux-nfc] " Krzysztof Kozlowski
@ 2021-06-01 13:37 ` Dan Carpenter
  2021-06-01 13:41   ` Nigel Christian
  1 sibling, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2021-06-01 13:37 UTC (permalink / raw)
  To: Nigel Christian; +Cc: Krzysztof Kozlowski, linux-nfc, netdev, kernel-janitors

On Tue, Jun 01, 2021 at 09:00:33AM -0400, Nigel Christian wrote:
> In the case MICROREAD_CB_TYPE_READER_ALL clang reports a dead
> code warning. The error code is being directly passed to 
> async_cb(). Fix this by passing the err variable, which is also
> done in another path.
> 
> Addresses-Coverity: ("Unused value") 
> Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
> ---
>  drivers/nfc/microread/microread.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
> index 8d3988457c58..130b0f554016 100644
> --- a/drivers/nfc/microread/microread.c
> +++ b/drivers/nfc/microread/microread.c
> @@ -367,7 +367,7 @@ static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
>  				err = -EPROTO;
>  				kfree_skb(skb);
>  				info->async_cb(info->async_cb_context, NULL,
> -					       -EPROTO);
> +					       err);

It would be better to just delete the "err = -EPROTO;" assignment.

Literals are more readable.  Avoid pointless indirection.

regards,
dan carpenter



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

* Re: [PATCH] NFC: microread: Pass err variable to async_cb()
  2021-06-01 13:37 ` Dan Carpenter
@ 2021-06-01 13:41   ` Nigel Christian
  0 siblings, 0 replies; 6+ messages in thread
From: Nigel Christian @ 2021-06-01 13:41 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors

On Tue, Jun 01, 2021 at 04:37:57PM +0300, Dan Carpenter wrote:
> On Tue, Jun 01, 2021 at 09:00:33AM -0400, Nigel Christian wrote:
> > In the case MICROREAD_CB_TYPE_READER_ALL clang reports a dead
> > code warning. The error code is being directly passed to 
> > async_cb(). Fix this by passing the err variable, which is also
> > done in another path.
> > 
> > Addresses-Coverity: ("Unused value") 
> > Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
> > ---
> >  drivers/nfc/microread/microread.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
> > index 8d3988457c58..130b0f554016 100644
> > --- a/drivers/nfc/microread/microread.c
> > +++ b/drivers/nfc/microread/microread.c
> > @@ -367,7 +367,7 @@ static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
> >  				err = -EPROTO;
> >  				kfree_skb(skb);
> >  				info->async_cb(info->async_cb_context, NULL,
> > -					       -EPROTO);
> > +					       err);
> 
> It would be better to just delete the "err = -EPROTO;" assignment.
> 
> Literals are more readable.  Avoid pointless indirection.

Yeah, my bad. v2 sent! Thanks Dan!

> 
> regards,
> dan carpenter
> 
> 

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

end of thread, other threads:[~2021-06-01 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-01 13:00 [PATCH] NFC: microread: Pass err variable to async_cb() Nigel Christian
2021-06-01 13:07 ` Krzysztof Kozlowski
2021-06-01 13:07   ` Krzysztof Kozlowski
2021-06-01 13:07   ` [linux-nfc] " Krzysztof Kozlowski
2021-06-01 13:37 ` Dan Carpenter
2021-06-01 13:41   ` Nigel Christian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.