Skip to contentSkip to conversation

stm class: Use a signed return type for stm_find_master_chan

PATCH Applied Lucas Tanure 2 participants 2 messages Jan 26, 2016 – Feb 5, 2016

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

PATCH 1/1 stm class: Use a signed return type for stm_find_master_chan

The return type "unsigned int" was used by the stm_find_master_chan function despite of the aspect that it will eventually return a negative error code.

Done with the help of Coccinelle.

---
 drivers/hwtracing/stm/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/stm/core.c +2 -2
index b6445d9..cc520f0 100644
@@ -233,7 +233,7 @@ static int find_free_channels(unsigned long *bitmap, unsigned int start,
 	return -1;
 }
 
-static unsigned int
+static int
 stm_find_master_chan(struct stm_device *stm, unsigned int width,
 		     unsigned int *mstart, unsigned int mend,
 		     unsigned int *cstart, unsigned int cend)
@@ -293,7 +293,7 @@ static int stm_output_assign(struct stm_device *stm, unsigned int width,
 		goto unlock;
 
 	ret = stm_find_master_chan(stm, width, &midx, mend, &cidx, cend);
-	if (ret)
+	if (ret < 0)
 		goto unlock;
 
 	output->master = midx;
Signature · 1 line
2.7.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Lucas Tanure

The return type "unsigned int" was used by the stm_find_master_chan function despite of the aspect that it will eventually return a negative error code.

Done with the help of Coccinelle.

Applied to my queue, thank you!

Regards,
--
Alex