Skip to contentSkip to conversation

staging-slicoss: Use a signed return type for slic_card_locate()

PATCH Superseded SF Markus Elfring 2 participants 3 messages Dec 19, 2015 – Dec 22, 2015

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

PATCH 1/1 staging-slicoss: Use a signed return type for slic_card_locate()

From: Markus Elfring <[email protected]>
Date: Sat, 19 Dec 2015 20:30:39 +0100

The return type "u32" was used by the slic_card_locate() function despite of the aspect that it will eventually return a negative error code.
Improve this implementation detail by using the type "s32" instead.

This issue was detected by using the Coccinelle software.

---
 drivers/staging/slicoss/slicoss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/slicoss/slicoss.c +1 -1
index b23a2d1..9ba0e4b 100644
@@ -2953,7 +2953,7 @@ static const struct net_device_ops slic_netdev_ops = {
 	.ndo_change_mtu		= eth_change_mtu,
 };
 
-static u32 slic_card_locate(struct adapter *adapter)
+static s32 slic_card_locate(struct adapter *adapter)
 {
 	struct sliccard *card = slic_global.slic_card;
 	struct physcard *physcard = slic_global.phys_card;
Signature · 1 line
2.6.3
#1 lore raw

It returns zero or negative error codes. The callers expect int. It is harmless. It should just be int.

regards,
dan carpenter

#2 lore raw

PATCH v2 1/1 staging-slicoss: Use a signed return type for slic_card_locate()

From: Markus Elfring <[email protected]>
Date: Tue, 22 Dec 2015 15:05:16 +0100

The return type "u32" was used by the slic_card_locate() function even though it will eventually return a negative error code. Improve this implementation detail by using the type "int" instead.

This issue was detected by using the Coccinelle software.

---
 drivers/staging/slicoss/slicoss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/slicoss/slicoss.c +1 -1
index b23a2d1..156e57f 100644
@@ -2953,7 +2953,7 @@ static const struct net_device_ops slic_netdev_ops = {
 	.ndo_change_mtu		= eth_change_mtu,
 };
 
-static u32 slic_card_locate(struct adapter *adapter)
+static int slic_card_locate(struct adapter *adapter)
 {
 	struct sliccard *card = slic_global.slic_card;
 	struct physcard *physcard = slic_global.phys_card;
Signature · 1 line
2.6.3