Skip to content

Commit a3d97c9

Browse files
Julia Lawallgregkh
authored andcommitted
Staging: cpc-usb: Adjust NULL test
Since card must already be non-NULL, it seems that what was intended was to test the result of kmalloc. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ expression E,E1; identifier f,fld,fld1; statement S1,S2; @@ E->fld = f(...); ... when != E = E1 when != E->fld1 = E1 if ( - E + E->fld == NULL) S1 else S2 // </smpl> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 562bf48 commit a3d97c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/staging/cpc-usb/cpc-usb_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ static int cpcusb_probe(struct usb_interface *interface,
899899

900900
/* allocate and initialize the channel struct */
901901
card->chan = kmalloc(sizeof(CPC_CHAN_T), GFP_KERNEL);
902-
if (!card) {
902+
if (!card->chan) {
903903
kfree(card);
904904
err("Out of memory");
905905
return -ENOMEM;

0 commit comments

Comments
 (0)