* [PATCH 4/5] drivers/bluetooth: change simple_strtol to simple_strtoul
@ 2008-11-25 13:14 Julia Lawall
2008-11-30 8:53 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2008-11-25 13:14 UTC (permalink / raw)
To: marcel, linux-bluetooth, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Since size, addr, fcs, and tmp are unsigned, it would seem better to use
simple_strtoul that simple_strtol.
A simplified version of the semantic patch that makes this change is as
follows: (http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r2@
long e;
position p;
@@
e = simple_strtol@p(...)
@@
position p != r2.p;
type T;
T e;
@@
e =
- simple_strtol@p
+ simple_strtoul
(...)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/bluetooth/bt3c_cs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff -u -p a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -502,15 +502,15 @@ static int bt3c_load_firmware(bt3c_info_
memset(b, 0, sizeof(b));
memcpy(b, ptr + 2, 2);
- size = simple_strtol(b, NULL, 16);
+ size = simple_strtoul(b, NULL, 16);
memset(b, 0, sizeof(b));
memcpy(b, ptr + 4, 8);
- addr = simple_strtol(b, NULL, 16);
+ addr = simple_strtoul(b, NULL, 16);
memset(b, 0, sizeof(b));
memcpy(b, ptr + (size * 2) + 2, 2);
- fcs = simple_strtol(b, NULL, 16);
+ fcs = simple_strtoul(b, NULL, 16);
memset(b, 0, sizeof(b));
for (tmp = 0, i = 0; i < size; i++) {
@@ -530,7 +530,7 @@ static int bt3c_load_firmware(bt3c_info_
memset(b, 0, sizeof(b));
for (i = 0; i < (size - 4) / 2; i++) {
memcpy(b, ptr + (i * 4) + 12, 4);
- tmp = simple_strtol(b, NULL, 16);
+ tmp = simple_strtoul(b, NULL, 16);
bt3c_put(iobase, tmp);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 4/5] drivers/bluetooth: change simple_strtol to simple_strtoul
2008-11-25 13:14 [PATCH 4/5] drivers/bluetooth: change simple_strtol to simple_strtoul Julia Lawall
@ 2008-11-30 8:53 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2008-11-30 8:53 UTC (permalink / raw)
To: Julia Lawall; +Cc: linux-bluetooth, linux-kernel, kernel-janitors
Hi Julia,
> From: Julia Lawall <julia@diku.dk>
>
> Since size, addr, fcs, and tmp are unsigned, it would seem better to use
> simple_strtoul that simple_strtol.
>
> A simplified version of the semantic patch that makes this change is as
> follows: (http://www.emn.fr/x-info/coccinelle/)
patch has been applied to my tree. Thanks.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-30 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-25 13:14 [PATCH 4/5] drivers/bluetooth: change simple_strtol to simple_strtoul Julia Lawall
2008-11-30 8:53 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome