Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
Bluetooth: bt3c_cs: Fix obsolete function
Browse files Browse the repository at this point in the history
simple_strtol and simple_strtoul are obsolete, both place
use kstrtouint instead.

V2: fix error tmp += tn
V3: fix compile error

Signed-off-by: Ding Xiang <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
Ding Xiang authored and holtmann committed Sep 27, 2018
1 parent 7cbfd1e commit 3856135
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ static int bt3c_load_firmware(struct bt3c_info *info,
{
char *ptr = (char *) firmware;
char b[9];
unsigned int iobase, tmp;
unsigned int iobase, tmp, tn;
unsigned long size, addr, fcs;
int i, err = 0;

Expand Down Expand Up @@ -490,7 +490,9 @@ static int bt3c_load_firmware(struct bt3c_info *info,
memset(b, 0, sizeof(b));
for (tmp = 0, i = 0; i < size; i++) {
memcpy(b, ptr + (i * 2) + 2, 2);
tmp += simple_strtol(b, NULL, 16);
if (kstrtouint(b, 16, &tn))
return -EINVAL;
tmp += tn;
}

if (((tmp + fcs) & 0xff) != 0xff) {
Expand All @@ -505,7 +507,8 @@ static int bt3c_load_firmware(struct bt3c_info *info,
memset(b, 0, sizeof(b));
for (i = 0; i < (size - 4) / 2; i++) {
memcpy(b, ptr + (i * 4) + 12, 4);
tmp = simple_strtoul(b, NULL, 16);
if (kstrtouint(b, 16, &tmp))
return -EINVAL;
bt3c_put(iobase, tmp);
}
}
Expand Down

0 comments on commit 3856135

Please sign in to comment.