Skip to content

Commit 9c6603e

Browse files
Dan Carpentermartinkpetersen
authored andcommitted
scsi: target: configfs: Delete unnecessary checks for NULL
The "item" pointer is always going to be valid pointer and does not need to be checked. But if "item" were NULL then item_to_lun() would not return a NULL, but instead, the container_of() pointer math would return a value in the error pointer range. This confuses static checkers since it looks like a NULL vs IS_ERR() bug. Delete the bogus checks. Link: https://lore.kernel.org/r/20211118084900.GA24550@kili Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e2a49a9 commit 9c6603e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/target/target_core_fabric_configfs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ static ssize_t target_fabric_port_alua_tg_pt_gp_show(struct config_item *item,
520520
{
521521
struct se_lun *lun = item_to_lun(item);
522522

523-
if (!lun || !lun->lun_se_dev)
523+
if (!lun->lun_se_dev)
524524
return -ENODEV;
525525

526526
return core_alua_show_tg_pt_gp_info(lun, page);
@@ -531,7 +531,7 @@ static ssize_t target_fabric_port_alua_tg_pt_gp_store(struct config_item *item,
531531
{
532532
struct se_lun *lun = item_to_lun(item);
533533

534-
if (!lun || !lun->lun_se_dev)
534+
if (!lun->lun_se_dev)
535535
return -ENODEV;
536536

537537
return core_alua_store_tg_pt_gp_info(lun, page, count);
@@ -542,7 +542,7 @@ static ssize_t target_fabric_port_alua_tg_pt_offline_show(
542542
{
543543
struct se_lun *lun = item_to_lun(item);
544544

545-
if (!lun || !lun->lun_se_dev)
545+
if (!lun->lun_se_dev)
546546
return -ENODEV;
547547

548548
return core_alua_show_offline_bit(lun, page);
@@ -553,7 +553,7 @@ static ssize_t target_fabric_port_alua_tg_pt_offline_store(
553553
{
554554
struct se_lun *lun = item_to_lun(item);
555555

556-
if (!lun || !lun->lun_se_dev)
556+
if (!lun->lun_se_dev)
557557
return -ENODEV;
558558

559559
return core_alua_store_offline_bit(lun, page, count);
@@ -564,7 +564,7 @@ static ssize_t target_fabric_port_alua_tg_pt_status_show(
564564
{
565565
struct se_lun *lun = item_to_lun(item);
566566

567-
if (!lun || !lun->lun_se_dev)
567+
if (!lun->lun_se_dev)
568568
return -ENODEV;
569569

570570
return core_alua_show_secondary_status(lun, page);
@@ -575,7 +575,7 @@ static ssize_t target_fabric_port_alua_tg_pt_status_store(
575575
{
576576
struct se_lun *lun = item_to_lun(item);
577577

578-
if (!lun || !lun->lun_se_dev)
578+
if (!lun->lun_se_dev)
579579
return -ENODEV;
580580

581581
return core_alua_store_secondary_status(lun, page, count);
@@ -586,7 +586,7 @@ static ssize_t target_fabric_port_alua_tg_pt_write_md_show(
586586
{
587587
struct se_lun *lun = item_to_lun(item);
588588

589-
if (!lun || !lun->lun_se_dev)
589+
if (!lun->lun_se_dev)
590590
return -ENODEV;
591591

592592
return core_alua_show_secondary_write_metadata(lun, page);
@@ -597,7 +597,7 @@ static ssize_t target_fabric_port_alua_tg_pt_write_md_store(
597597
{
598598
struct se_lun *lun = item_to_lun(item);
599599

600-
if (!lun || !lun->lun_se_dev)
600+
if (!lun->lun_se_dev)
601601
return -ENODEV;
602602

603603
return core_alua_store_secondary_write_metadata(lun, page, count);

0 commit comments

Comments
 (0)