Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

+2 -2
+2 -2
drivers/block/mtip32xx/mtip32xx.c
··· 2725 2725 spin_lock_irqsave(&dev_lock, flags); 2726 2726 size += sprintf(&buf[size], "Devices Present:\n"); 2727 2727 list_for_each_entry_safe(dd, tmp, &online_list, online_list) { 2728 - if (dd && dd->pdev) { 2728 + if (dd->pdev) { 2729 2729 if (dd->port && 2730 2730 dd->port->identify && 2731 2731 dd->port->identify_valid) { ··· 2755 2755 2756 2756 size += sprintf(&buf[size], "Devices Being Removed:\n"); 2757 2757 list_for_each_entry_safe(dd, tmp, &removing_list, remove_list) { 2758 - if (dd && dd->pdev) { 2758 + if (dd->pdev) { 2759 2759 if (dd->port && 2760 2760 dd->port->identify && 2761 2761 dd->port->identify_valid) {