提交 a3d97c9b 编写于 作者: J Julia Lawall 提交者: Greg Kroah-Hartman

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: NJulia Lawall <julia@diku.dk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 562bf484
......@@ -899,7 +899,7 @@ static int cpcusb_probe(struct usb_interface *interface,
/* allocate and initialize the channel struct */
card->chan = kmalloc(sizeof(CPC_CHAN_T), GFP_KERNEL);
if (!card) {
if (!card->chan) {
kfree(card);
err("Out of memory");
return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册