Skip to content

Commit

Permalink
zram: fix error return code
Browse files Browse the repository at this point in the history
(cherry pick from commit 201c7b72f0bf38d7f31fd229a01de035d0f10cd1)

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 <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Nitin Gupta <[email protected]>
Acked-by: Sergey Senozhatsky <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Bug: 24810447
Change-Id: I80e5b9d0b3185128b35a4f15b2c10ffd2b43d826
Signed-off-by: hemantbeast <[email protected]>
  • Loading branch information
JuliaLawall authored and hemantbeast committed Jul 28, 2016
1 parent 76ca954 commit 95db9ad
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/block/zram/zram_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ static int create_device(struct zram *zram, int device_id)
if (!zram->disk) {
pr_warn("Error allocating disk structure for device %d\n",
device_id);
ret = -ENOMEM;
goto out_free_queue;
}

Expand Down

0 comments on commit 95db9ad

Please sign in to comment.