Skip to content

Commit aeb5e02

Browse files
nathanchancedavem330
authored andcommitted
mISDN: Fix type of switch control variable in ctrl_teimanager
Clang warns (trimmed for brevity): drivers/isdn/mISDN/tei.c:1193:7: warning: overflow converting case value to switch condition type (2147764552 to 18446744071562348872) [-Wswitch] case IMHOLD_L1: ^ drivers/isdn/mISDN/tei.c:1187:7: warning: overflow converting case value to switch condition type (2147764550 to 18446744071562348870) [-Wswitch] case IMCLEAR_L2: ^ 2 warnings generated. The root cause is that the _IOC macro can generate really large numbers, which don't find into type int. My research into how GCC and Clang are handling this at a low level didn't prove fruitful and surveying the kernel tree shows that aside from here and a few places in the scsi subsystem, everything that uses _IOC is at least of type 'unsigned int'. Make that change here because as nothing in this function cares about the signedness of the variable and it removes ambiguity, which is never good when dealing with compilers. While we're here, remove the unnecessary local variable ret (just return -EINVAL and 0 directly). Link: ClangBuiltLinux/linux#67 Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 988f3f1 commit aeb5e02

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/isdn/mISDN/tei.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,8 +1180,7 @@ static int
11801180
ctrl_teimanager(struct manager *mgr, void *arg)
11811181
{
11821182
/* currently we only have one option */
1183-
int *val = (int *)arg;
1184-
int ret = 0;
1183+
unsigned int *val = (unsigned int *)arg;
11851184

11861185
switch (val[0]) {
11871186
case IMCLEAR_L2:
@@ -1197,9 +1196,9 @@ ctrl_teimanager(struct manager *mgr, void *arg)
11971196
test_and_clear_bit(OPTION_L1_HOLD, &mgr->options);
11981197
break;
11991198
default:
1200-
ret = -EINVAL;
1199+
return -EINVAL;
12011200
}
1202-
return ret;
1201+
return 0;
12031202
}
12041203

12051204
/* This function does create a L2 for fixed TEI in NT Mode */

0 commit comments

Comments
 (0)