Skip to contentSkip to conversation

ti-st: Use a signed return type for st_ll_sleep_state()

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 ti-st: Use a signed return type for st_ll_sleep_state()

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

---
 drivers/misc/ti-st/st_ll.c   | 2 +-
 include/linux/ti_wilink_st.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/ti-st/st_ll.c +1 -1
index 93b4d67..dacf071 100644
@@ -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) {
include/linux/ti_wilink_st.h +1 -1
index 0a0d568..9604352 100644
@@ -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 *);
 
 /*
Signature · 1 line
2.6.3
#1 lore raw

It returns zero or negative error codes. The return value is never checked. Make it an int.

regards,
dan carpenter

#2 lore raw

PATCH v2 1/1 ti-st: Use a signed return type for st_ll_sleep_state()

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

---
 drivers/misc/ti-st/st_ll.c   | 2 +-
 include/linux/ti_wilink_st.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/ti-st/st_ll.c +1 -1
index 93b4d67..788d436 100644
@@ -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) {
include/linux/ti_wilink_st.h +1 -1
index 0a0d568..4205eb2 100644
@@ -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 *);
 
 /*
Signature · 1 line
2.6.3