mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 13:34:10 +08:00
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) 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>
This commit is contained in:
parent
238822bc91
commit
59d3fe5404
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user