kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging-slicoss: Use a signed return type for slic_card_locate()
@ 2015-12-19 19:37 SF Markus Elfring
  2015-12-19 20:19 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: SF Markus Elfring @ 2015-12-19 19:37 UTC (permalink / raw)
  To: Christopher Harrer, Greg Kroah-Hartman, Lior Dotan, devel
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
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.

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

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index b23a2d1..9ba0e4b 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -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;
-- 
2.6.3


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

* Re: [PATCH] staging-slicoss: Use a signed return type for slic_card_locate()
  2015-12-19 19:37 [PATCH] staging-slicoss: Use a signed return type for slic_card_locate() SF Markus Elfring
@ 2015-12-19 20:19 ` Dan Carpenter
  2015-12-22 14:12   ` [PATCH v2] " SF Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-12-19 20:19 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Christopher Harrer, Greg Kroah-Hartman, Lior Dotan, devel,
	Julia Lawall, kernel-janitors, LKML

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

regards,
dan carpenter


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

* [PATCH v2] staging-slicoss: Use a signed return type for slic_card_locate()
  2015-12-19 20:19 ` Dan Carpenter
@ 2015-12-22 14:12   ` SF Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2015-12-22 14:12 UTC (permalink / raw)
  To: Christopher Harrer, Dan Carpenter, Greg Kroah-Hartman, Lior Dotan,
	devel
  Cc: Julia Lawall, kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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.

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

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index b23a2d1..156e57f 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -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;
-- 
2.6.3


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

end of thread, other threads:[~2015-12-22 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-19 19:37 [PATCH] staging-slicoss: Use a signed return type for slic_card_locate() SF Markus Elfring
2015-12-19 20:19 ` Dan Carpenter
2015-12-22 14:12   ` [PATCH v2] " SF Markus Elfring

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).