diff mbox series

ibmvnic: Use -EBUSY in __ibmvnic_reset()

Message ID 4cff158d-b5ac-4dca-9fbb-626237c1eafe@web.de (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series ibmvnic: Use -EBUSY in __ibmvnic_reset() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 14 of 14 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 5 this patch: 5
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-21--03-00 (tests: 995)

Commit Message

Markus Elfring April 19, 2024, 2:08 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 19 Apr 2024 15:46:17 +0200

Add a minus sign before the error code “EBUSY”
so that a negative value will be used as in other cases.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.44.0

Comments

Paolo Abeni April 23, 2024, 10:54 a.m. UTC | #1
On Fri, 2024-04-19 at 16:08 +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 19 Apr 2024 15:46:17 +0200
> 
> Add a minus sign before the error code “EBUSY”
> so that a negative value will be used as in other cases.
> 
> This issue was transformed by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 5e9a93bdb518..737ae83a836a 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -3212,7 +3212,7 @@ static void __ibmvnic_reset(struct work_struct *work)
>  		    adapter->state == VNIC_REMOVED) {
>  			spin_unlock_irqrestore(&adapter->state_lock, flags);
>  			kfree(rwi);
> -			rc = EBUSY;
> +			rc = -EBUSY;
>  			break;
> 

AFAICS the error is always used as bool, so this will not change any
behavior in practice. I tend to think we should not merge this kind of
change outside some larger work in the same area, but I'd love a second
opinion from the driver owners.

Thanks,

Paolo
> 		}
Dan Carpenter April 23, 2024, 11:55 a.m. UTC | #2
On Tue, Apr 23, 2024 at 12:54:55PM +0200, Paolo Abeni wrote:
> On Fri, 2024-04-19 at 16:08 +0200, Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Fri, 19 Apr 2024 15:46:17 +0200
> > 
> > Add a minus sign before the error code “EBUSY”
> > so that a negative value will be used as in other cases.
> > 
> > This issue was transformed by using the Coccinelle software.
> > 
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > ---
> >  drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> > index 5e9a93bdb518..737ae83a836a 100644
> > --- a/drivers/net/ethernet/ibm/ibmvnic.c
> > +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> > @@ -3212,7 +3212,7 @@ static void __ibmvnic_reset(struct work_struct *work)
> >  		    adapter->state == VNIC_REMOVED) {
> >  			spin_unlock_irqrestore(&adapter->state_lock, flags);
> >  			kfree(rwi);
> > -			rc = EBUSY;
> > +			rc = -EBUSY;
> >  			break;
> > 
> 
> AFAICS the error is always used as bool, so this will not change any
> behavior in practice. I tend to think we should not merge this kind of
> change outside some larger work in the same area, but I'd love a second
> opinion from the driver owners.

I missed the original patch due to my procmail filters...

You're right that it doesn't affect the behavior of the driver except
for the debug output when we do:

	netdev_dbg(adapter->netdev, "Reset failed, rc=%d\n", rc);

But the - was left off uninitentionally so I think we should apply it.

I have been trying to look for similar bugs where the - is left off.
It's a bit challenging because there places where we use positive
error codes deliberately.  But in this case a static checker could
easily detect the bug with a low false positive ratio by saying, "We're
mixing normal negative error codes with positive EBUSY".

regards,
dan carpenter
Nick Child April 23, 2024, 2:55 p.m. UTC | #3
On 4/23/24 06:55, Dan Carpenter wrote:
> On Tue, Apr 23, 2024 at 12:54:55PM +0200, Paolo Abeni wrote:
>> On Fri, 2024-04-19 at 16:08 +0200, Markus Elfring wrote:
>>> From: Markus Elfring <elfring@users.sourceforge.net>
>>> Date: Fri, 19 Apr 2024 15:46:17 +0200
>>>
>>> Add a minus sign before the error code “EBUSY”
>>> so that a negative value will be used as in other cases.
>>>
>>> This issue was transformed by using the Coccinelle software.
>>>
>>> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
>>> ---
>>>   drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
>>> index 5e9a93bdb518..737ae83a836a 100644
>>> --- a/drivers/net/ethernet/ibm/ibmvnic.c
>>> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
>>> @@ -3212,7 +3212,7 @@ static void __ibmvnic_reset(struct work_struct *work)
>>>   		    adapter->state == VNIC_REMOVED) {
>>>   			spin_unlock_irqrestore(&adapter->state_lock, flags);
>>>   			kfree(rwi);
>>> -			rc = EBUSY;
>>> +			rc = -EBUSY;
>>>   			break;
>>>
>>
>> AFAICS the error is always used as bool, so this will not change any
>> behavior in practice. I tend to think we should not merge this kind of
>> change outside some larger work in the same area, but I'd love a second
>> opinion from the driver owners.
> 
> I missed the original patch due to my procmail filters...
> 
> You're right that it doesn't affect the behavior of the driver except
> for the debug output when we do:
> 
> 	netdev_dbg(adapter->netdev, "Reset failed, rc=%d\n", rc);
> 
> But the - was left off uninitentionally so I think we should apply it.
> 
> I have been trying to look for similar bugs where the - is left off.
> It's a bit challenging because there places where we use positive
> error codes deliberately.  But in this case a static checker could
> easily detect the bug with a low false positive ratio by saying, "We're
> mixing normal negative error codes with positive EBUSY".
> 
> regards,
> dan carpenter

Hello, small clarification, this patch will not effect the debug print 
statement due to the break statement immediately following:
	while () {	
		if () {
			rc = -EBUSY;
			break;
		}
		netdev_dbg(adapter->netdev, "Reset failed, rc=%d\n", rc);
	}
Though this return code can be passed to adapter->reset_done_rc, which 
is only treated as a boolean.

So, the point of the patch not doing any behavioral differences is still 
true.
Personally, I don't have strong opinions on this.
Reviewed-by: Nick Child <nnac123@linux.ibm.com>
Dan Carpenter April 23, 2024, 3:41 p.m. UTC | #4
On Tue, Apr 23, 2024 at 09:55:57AM -0500, Nick Child wrote:
> > You're right that it doesn't affect the behavior of the driver except
> > for the debug output when we do:
> > 
> > 	netdev_dbg(adapter->netdev, "Reset failed, rc=%d\n", rc);
> > 
> > But the - was left off uninitentionally so I think we should apply it.
> > 
> > I have been trying to look for similar bugs where the - is left off.
> > It's a bit challenging because there places where we use positive
> > error codes deliberately.  But in this case a static checker could
> > easily detect the bug with a low false positive ratio by saying, "We're
> > mixing normal negative error codes with positive EBUSY".
> > 
> > regards,
> > dan carpenter
> 
> Hello, small clarification, this patch will not effect the debug print
> statement due to the break statement immediately following:
> 	while () {	
> 		if () {
> 			rc = -EBUSY;
> 			break;
> 		}
> 		netdev_dbg(adapter->netdev, "Reset failed, rc=%d\n", rc);
> 	}
> Though this return code can be passed to adapter->reset_done_rc, which is
> only treated as a boolean.
> 
> So, the point of the patch not doing any behavioral differences is still
> true.

Ah yes.  You're right.

regards,
dan carpenter
Jakub Kicinski April 25, 2024, 2:32 a.m. UTC | #5
On Tue, 23 Apr 2024 18:41:48 +0300 Dan Carpenter wrote:
> > So, the point of the patch not doing any behavioral differences is still
> > true.  
> 
> Ah yes.  You're right.

Hard call but overall I think this wasted more reviewer time than it's
worth. So in the spirit of not encouraging noise I'm not applying this.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 5e9a93bdb518..737ae83a836a 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3212,7 +3212,7 @@  static void __ibmvnic_reset(struct work_struct *work)
 		    adapter->state == VNIC_REMOVED) {
 			spin_unlock_irqrestore(&adapter->state_lock, flags);
 			kfree(rwi);
-			rc = EBUSY;
+			rc = -EBUSY;
 			break;
 		}