Skip to content

Commit

Permalink
Staging: dst: correct error-handling code
Browse files Browse the repository at this point in the history
dst_state_alloc returns an ERR_PTR value in an error case instead of NULL.

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

// <smpl>
@match exists@
expression x, E;
statement S1, S2;
@@

x = dst_state_alloc(...)
... when != x = E
(
*  if (x == NULL || ...) S1 else S2
|
*  if (x == NULL && ...) S1 else S2
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Julia Lawall authored and Greg Kroah-Hartman committed Sep 15, 2009
1 parent b6ac161 commit d0e0507
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/dst/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static struct dst_state *dst_accept_client(struct dst_state *st)
goto err_out_exit;

new = dst_state_alloc(st->node);
if (!new) {
if (IS_ERR(new)) {
err = -ENOMEM;
goto err_out_release;
}
Expand Down

0 comments on commit d0e0507

Please sign in to comment.