Skip to contentSkip to conversation

iio-light: Use a signed return type for ltr501_match_samp_freq()

PATCH Applied SF Markus Elfring 3 participants 4 messages Dec 19, 2015

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

PATCH 1/1 iio-light: Use a signed return type for ltr501_match_samp_freq()

From: Markus Elfring <[email protected]>
Date: Sat, 19 Dec 2015 14:14:54 +0100

The return type "unsigned int" was used by the ltr501_match_samp_freq() 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/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/ltr501.c +1 -1
index 809a961..6bf89d8 100644
@@ -180,7 +180,7 @@ static const struct ltr501_samp_table ltr501_ps_samp_table[] = {
 			{500000, 2000000}
 };
 
-static unsigned int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
+static int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
 					   int len, int val, int val2)
 {
 	int i, freq;
Signature · 1 line
2.6.3
maintainer Applied
#1 lore raw
Quoted 11 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 19 Dec 2015 14:14:54 +0100

The return type "unsigned int" was used by the ltr501_match_samp_freq() 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.

Applied to the fixes-togreg branch of iio.git and marked for stable.

Peter, I'll probably hold this locally for a few days anyway as Greg hasn't picked up the previous pull request yet. So if you want to add anything give me a shout.

Jonathan

Quoted 18 lines
---
 drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/ltr501.c +1 -1
index 809a961..6bf89d8 100644
@@ -180,7 +180,7 @@ static const struct ltr501_samp_table ltr501_ps_samp_table[] = {
 			{500000, 2000000}
 };
 
-static unsigned int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
+static int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
 					   int len, int val, int val2)
 {
 	int i, freq;
#2 lore raw
Quoted 9 lines · Jonathan Cameron
Quoted 8 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 19 Dec 2015 14:14:54 +0100

The return type "unsigned int" was used by the ltr501_match_samp_freq() 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.

Quoted 8 lines
Quoted 3 lines

This issue was detected by using the Coccinelle software.

Applied to the fixes-togreg branch of iio.git and marked for stable.

Peter, I'll probably hold this locally for a few days anyway as Greg hasn't picked up the previous pull request yet. So if you want to add anything give me a shout.

looks good

Quoted 20 lines

Jonathan

Quoted 18 lines
---
 drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/ltr501.c +1 -1
index 809a961..6bf89d8 100644
@@ -180,7 +180,7 @@ static const struct ltr501_samp_table ltr501_ps_samp_table[] = {
 			{500000, 2000000}
 };
 
-static unsigned int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
+static int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
 					   int len, int val, int val2)
 {
 	int i, freq;
Signature · 2 lines
Peter Meerwald-Stadler
+43-664-2444418 (mobile)
maintainer
#3 lore raw
Quoted 14 lines · Peter Meerwald-Stadler
Quoted 12 lines · Jonathan Cameron
Quoted 11 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 19 Dec 2015 14:14:54 +0100

The return type "unsigned int" was used by the ltr501_match_samp_freq() 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.

Quoted 8 lines
Quoted 5 lines

Applied to the fixes-togreg branch of iio.git and marked for stable.

Peter, I'll probably hold this locally for a few days anyway as Greg hasn't picked up the previous pull request yet. So if you want to add anything give me a shout.

looks good

Added to the commit.

Quoted 22 lines
Quoted 21 lines

Jonathan

Quoted 18 lines
---
 drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/ltr501.c +1 -1
index 809a961..6bf89d8 100644
@@ -180,7 +180,7 @@ static const struct ltr501_samp_table ltr501_ps_samp_table[] = {
 			{500000, 2000000}
 };
 
-static unsigned int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
+static int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
 					   int len, int val, int val2)
 {
 	int i, freq;