Commit c66bb3f0 authored by Jens Axboe's avatar Jens Axboe

mtip32xx: fix two smatch warnings

Dan reports:

New smatch warnings:
drivers/block/mtip32xx/mtip32xx.c:2728 show_device_status() warn: variable dereferenced before check 'dd' (see line 2727)
drivers/block/mtip32xx/mtip32xx.c:2758 show_device_status() warn: variable dereferenced before check 'dd' (see line 2757)

which are checking if dd == NULL, in a list_for_each_entry() type loop.
Get rid of the check, dd can never be NULL here.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 0caff003
...@@ -2725,7 +2725,7 @@ static ssize_t show_device_status(struct device_driver *drv, char *buf) ...@@ -2725,7 +2725,7 @@ static ssize_t show_device_status(struct device_driver *drv, char *buf)
spin_lock_irqsave(&dev_lock, flags); spin_lock_irqsave(&dev_lock, flags);
size += sprintf(&buf[size], "Devices Present:\n"); size += sprintf(&buf[size], "Devices Present:\n");
list_for_each_entry_safe(dd, tmp, &online_list, online_list) { list_for_each_entry_safe(dd, tmp, &online_list, online_list) {
if (dd && dd->pdev) { if (dd->pdev) {
if (dd->port && if (dd->port &&
dd->port->identify && dd->port->identify &&
dd->port->identify_valid) { dd->port->identify_valid) {
...@@ -2755,7 +2755,7 @@ static ssize_t show_device_status(struct device_driver *drv, char *buf) ...@@ -2755,7 +2755,7 @@ static ssize_t show_device_status(struct device_driver *drv, char *buf)
size += sprintf(&buf[size], "Devices Being Removed:\n"); size += sprintf(&buf[size], "Devices Being Removed:\n");
list_for_each_entry_safe(dd, tmp, &removing_list, remove_list) { list_for_each_entry_safe(dd, tmp, &removing_list, remove_list) {
if (dd && dd->pdev) { if (dd->pdev) {
if (dd->port && if (dd->port &&
dd->port->identify && dd->port->identify &&
dd->port->identify_valid) { dd->port->identify_valid) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment