* [PATCH] ti-st: Use a signed return type for st_ll_sleep_state()
@ 2015-12-19 16:22 SF Markus Elfring
2015-12-19 20:15 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: SF Markus Elfring @ 2015-12-19 16:22 UTC (permalink / raw)
To: LKML; +Cc: kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 19 Dec 2015 17:15:34 +0100
The return type "unsigned long" was used by the st_ll_sleep_state()
function despite of the aspect that it will eventually return a negative
error code.
Improve this implementation detail by deletion of the type modifier then.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/misc/ti-st/st_ll.c | 2 +-
include/linux/ti_wilink_st.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
index 93b4d67..dacf071 100644
--- a/drivers/misc/ti-st/st_ll.c
+++ b/drivers/misc/ti-st/st_ll.c
@@ -128,7 +128,7 @@ unsigned long st_ll_getstate(struct st_data_s *ll)
}
/* called from ST Core, when a PM related packet arrives */
-unsigned long st_ll_sleep_state(struct st_data_s *st_data,
+long st_ll_sleep_state(struct st_data_s *st_data,
unsigned char cmd)
{
switch (cmd) {
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 0a0d568..9604352 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -391,7 +391,7 @@ void st_ll_disable(struct st_data_s *);
* of the chip.
*/
unsigned long st_ll_getstate(struct st_data_s *);
-unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char);
+long st_ll_sleep_state(struct st_data_s *, unsigned char);
void st_ll_wakeup(struct st_data_s *);
/*
--
2.6.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ti-st: Use a signed return type for st_ll_sleep_state()
2015-12-19 16:22 [PATCH] ti-st: Use a signed return type for st_ll_sleep_state() SF Markus Elfring
@ 2015-12-19 20:15 ` Dan Carpenter
2015-12-22 13:45 ` [PATCH v2] " SF Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-12-19 20:15 UTC (permalink / raw)
To: SF Markus Elfring; +Cc: LKML, kernel-janitors, Julia Lawall
It returns zero or negative error codes. The return value is never
checked. Make it an int.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] ti-st: Use a signed return type for st_ll_sleep_state()
2015-12-19 20:15 ` Dan Carpenter
@ 2015-12-22 13:45 ` SF Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2015-12-22 13:45 UTC (permalink / raw)
To: Dan Carpenter, LKML; +Cc: kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 22 Dec 2015 14:40:47 +0100
The return type "unsigned long" was used by the st_ll_sleep_state()
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/misc/ti-st/st_ll.c | 2 +-
include/linux/ti_wilink_st.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
index 93b4d67..788d436 100644
--- a/drivers/misc/ti-st/st_ll.c
+++ b/drivers/misc/ti-st/st_ll.c
@@ -128,7 +128,7 @@ unsigned long st_ll_getstate(struct st_data_s *ll)
}
/* called from ST Core, when a PM related packet arrives */
-unsigned long st_ll_sleep_state(struct st_data_s *st_data,
+int st_ll_sleep_state(struct st_data_s *st_data,
unsigned char cmd)
{
switch (cmd) {
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 0a0d568..4205eb2 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -391,7 +391,7 @@ void st_ll_disable(struct st_data_s *);
* of the chip.
*/
unsigned long st_ll_getstate(struct st_data_s *);
-unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char);
+int st_ll_sleep_state(struct st_data_s *, unsigned char);
void st_ll_wakeup(struct st_data_s *);
/*
--
2.6.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-22 13:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-19 16:22 [PATCH] ti-st: Use a signed return type for st_ll_sleep_state() SF Markus Elfring
2015-12-19 20:15 ` Dan Carpenter
2015-12-22 13:45 ` [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).