Skip to content

Commit

Permalink
NFC: pn533: fix error return code
Browse files Browse the repository at this point in the history
Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Julia Lawall authored and Samuel Ortiz committed Apr 5, 2015
1 parent 9421ce1 commit 5df848f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/nfc/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -2554,8 +2554,10 @@ static int pn533_data_exchange_complete(struct pn533 *dev, void *_arg,
}

skb = pn533_build_response(dev);
if (!skb)
if (!skb) {
rc = -ENOMEM;
goto error;
}

arg->cb(arg->cb_context, skb, 0);
kfree(arg);
Expand Down

0 comments on commit 5df848f

Please sign in to comment.