diff options
author | Asai Thambi S P <asamymuthupa@micron.com> | 2013-04-12 14:27:17 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-04-14 04:24:24 -0400 |
commit | 5a79e1ac21681907f8cc58e1f78fc40af5bbb890 (patch) | |
tree | cbe99ab653516db10fef76e4aba6dc4fc919102e /drivers/block/mtip32xx | |
parent | cef5279735d3f6f0243e626963e6d5c84efade0a (diff) |
mtip32xx: fix a smatch warning
Reported smatch warning:
drivers/block/mtip32xx/mtip32xx.c:4163 mtip_block_shutdown() warn: variable dereferenced before check 'dd->disk' (see line 4159)
dd->disk->disk_name accessed before the check if dd->disk is NULL. Fixed this
and access of dd->queue/dd->disk->queue.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/mtip32xx')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 11cc9522cdd4..2d0d52f6ee2a 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -4053,26 +4053,24 @@ static int mtip_block_remove(struct driver_data *dd) | |||
4053 | */ | 4053 | */ |
4054 | static int mtip_block_shutdown(struct driver_data *dd) | 4054 | static int mtip_block_shutdown(struct driver_data *dd) |
4055 | { | 4055 | { |
4056 | dev_info(&dd->pdev->dev, | ||
4057 | "Shutting down %s ...\n", dd->disk->disk_name); | ||
4058 | |||
4059 | /* Delete our gendisk structure, and cleanup the blk queue. */ | 4056 | /* Delete our gendisk structure, and cleanup the blk queue. */ |
4060 | if (dd->disk) { | 4057 | if (dd->disk) { |
4061 | if (dd->disk->queue) | 4058 | dev_info(&dd->pdev->dev, |
4059 | "Shutting down %s ...\n", dd->disk->disk_name); | ||
4060 | |||
4061 | if (dd->disk->queue) { | ||
4062 | del_gendisk(dd->disk); | 4062 | del_gendisk(dd->disk); |
4063 | else | 4063 | blk_cleanup_queue(dd->queue); |
4064 | } else | ||
4064 | put_disk(dd->disk); | 4065 | put_disk(dd->disk); |
4066 | dd->disk = NULL; | ||
4067 | dd->queue = NULL; | ||
4065 | } | 4068 | } |
4066 | 4069 | ||
4067 | |||
4068 | spin_lock(&rssd_index_lock); | 4070 | spin_lock(&rssd_index_lock); |
4069 | ida_remove(&rssd_index_ida, dd->index); | 4071 | ida_remove(&rssd_index_ida, dd->index); |
4070 | spin_unlock(&rssd_index_lock); | 4072 | spin_unlock(&rssd_index_lock); |
4071 | 4073 | ||
4072 | blk_cleanup_queue(dd->queue); | ||
4073 | dd->disk = NULL; | ||
4074 | dd->queue = NULL; | ||
4075 | |||
4076 | mtip_hw_shutdown(dd); | 4074 | mtip_hw_shutdown(dd); |
4077 | return 0; | 4075 | return 0; |
4078 | } | 4076 | } |