Skip to content

Commit 9ee0be0

Browse files
fmalitaJeff Garzik
authored andcommitted
ISDN HiSax: uninitialized return in hisax_cs_setup
Coverity (1792) spotted a possibly uninitialized return value in case of kmalloc() failure: 1116 static int hisax_cs_setup(int cardnr, struct IsdnCard *card, 1117 struct IsdnCardState *cs) 1119 int ret; 1120 1121 if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) { 1122 printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n"); 1123 ll_unload(cs); 1124 goto outf_cs; ... 1165 outf_cs: 1166 kfree(cs); 1167 card->cs = NULL; 1168 return ret; The straightforward solution would be to just add the missing initialization but hardcoding the return value in the out_cs branch (only taken on failure) seems to work just as well and it allows killing a couple of other lines too. Signed-off-by: Florin Malita <fmalita@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
1 parent 5bae7ac commit 9ee0be0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/isdn/hisax/config.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,14 +1146,12 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
11461146
}
11471147
if (ret) {
11481148
closecard(cardnr);
1149-
ret = 0;
11501149
goto outf_cs;
11511150
}
11521151
init_tei(cs, cs->protocol);
11531152
ret = CallcNewChan(cs);
11541153
if (ret) {
11551154
closecard(cardnr);
1156-
ret = 0;
11571155
goto outf_cs;
11581156
}
11591157
/* ISAR needs firmware download first */
@@ -1165,7 +1163,7 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
11651163
outf_cs:
11661164
kfree(cs);
11671165
card->cs = NULL;
1168-
return ret;
1166+
return 0;
11691167
}
11701168

11711169
static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner)

0 commit comments

Comments
 (0)