Skip to contentSkip to conversation

ibmvnic: Use -EBUSY in __ibmvnic_reset()

PATCH In review Markus Elfring 5 participants 6 messages Apr 19, 2024 – Apr 25, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibmvnic: Use -EBUSY in __ibmvnic_reset()

From: Markus Elfring <[email protected]>
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.

---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmvnic.c +1 -1
index 5e9a93bdb518..737ae83a836a 100644
@@ -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;
 		}
 

--
2.44.0

maintainer
#1 lore raw
Quoted 18 lines · Markus Elfring

From: Markus Elfring <[email protected]>
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.

---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -0
index 5e9a93bdb518..737ae83a836a 100644

drivers/net/ethernet/ibm/ibmvnic.c static void __ibmvnic_reset(struct work_struct *work) · line 3217

Quoted 7 lines
drivers/net/ethernet/ibm/ibmvnic.c +1 -1
@@ -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

Quoted 1 line
drivers/net/ethernet/ibm/ibmvnic.c +0 -0
 		}
#2 lore raw
Quoted 23 lines · Paolo Abeni
Quoted 22 lines · Markus Elfring

From: Markus Elfring <[email protected]>
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.

---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -1
index 5e9a93bdb518..737ae83a836a 100644
@@ -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;
Quoted 8 lines

drivers/net/ethernet/ibm/ibmvnic.c static void __ibmvnic_reset(struct work_struct *work) · line 3218

Quoted 3 lines
drivers/net/ethernet/ibm/ibmvnic.c +1 -0
+			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

reviewer Reviewed-by
#3 lore raw
Quoted 42 lines · Dan Carpenter
Quoted 23 lines · Paolo Abeni
Quoted 22 lines · Markus Elfring

From: Markus Elfring <[email protected]>
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.

---
  drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -1
index 5e9a93bdb518..737ae83a836a 100644
@@ -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;
Quoted 8 lines

drivers/net/ethernet/ibm/ibmvnic.c static void __ibmvnic_reset(struct work_struct *work) · line 3218

Quoted 3 lines
drivers/net/ethernet/ibm/ibmvnic.c +1 -0
+			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.

Quoted 8 lines

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.

#4 lore raw
Quoted 25 lines · Nick Child
Quoted 7 lines

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.

Quoted 8 lines

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);
	}
Quoted 5 lines

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

maintainer
#5 lore raw
Quoted 4 lines · On Tue, 23 Apr 2024 18:41:48 +0300 Dan Carpenter wrote:
Quoted 2 lines

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.

Signature · 1 line
pw-bot: reject