summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRashika Kheria <rashika.kheria@gmail.com>2013-10-30 18:43:32 +0530
committerChanho Park <chanho61.park@samsung.com>2014-03-20 17:44:30 +0900
commitbad433ba1451933e24bb52ebf051a13d39224091 (patch)
treefa8953d6c107a010da8243810e9587932721a9a6
parente8ed73197ecb6e2fd9c7d039d2317e642dbe54bc (diff)
downloadlinux-3.10-bad433ba1451933e24bb52ebf051a13d39224091.tar.gz
linux-3.10-bad433ba1451933e24bb52ebf051a13d39224091.tar.bz2
linux-3.10-bad433ba1451933e24bb52ebf051a13d39224091.zip
Staging: zram: Fix variable dereferenced before check
This patch fixes the following Smatch warning in zram_drv.c- drivers/staging/zram/zram_drv.c:899 destroy_device() warn: variable dereferenced before check 'zram->disk' (see line 896) Change-Id: If920cb9e1328289c561de89e074523071cd772b5 Acked-by: Minchan Kim <minchan@kernel.org> Acked-by: Jerome Marchand <jmarchan@redhat.com> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/zram/zram_drv.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 2c4ed52ca84..b704d06943f 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -896,13 +896,10 @@ static void destroy_device(struct zram *zram)
sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
&zram_disk_attr_group);
- if (zram->disk) {
- del_gendisk(zram->disk);
- put_disk(zram->disk);
- }
+ del_gendisk(zram->disk);
+ put_disk(zram->disk);
- if (zram->queue)
- blk_cleanup_queue(zram->queue);
+ blk_cleanup_queue(zram->queue);
}
static int __init zram_init(void)