Skip to content

Commit

Permalink
scsi: target: configfs: Delete unnecessary checks for NULL
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Dan Carpenter authored and martinkpetersen committed Nov 19, 2021
1 parent e2a49a9 commit 9c6603e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/target/target_core_fabric_configfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ static ssize_t target_fabric_port_alua_tg_pt_gp_show(struct config_item *item,
{
struct se_lun *lun = item_to_lun(item);

if (!lun || !lun->lun_se_dev)
if (!lun->lun_se_dev)
return -ENODEV;

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

if (!lun || !lun->lun_se_dev)
if (!lun->lun_se_dev)
return -ENODEV;

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

if (!lun || !lun->lun_se_dev)
if (!lun->lun_se_dev)
return -ENODEV;

return core_alua_show_offline_bit(lun, page);
Expand All @@ -553,7 +553,7 @@ static ssize_t target_fabric_port_alua_tg_pt_offline_store(
{
struct se_lun *lun = item_to_lun(item);

if (!lun || !lun->lun_se_dev)
if (!lun->lun_se_dev)
return -ENODEV;

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

if (!lun || !lun->lun_se_dev)
if (!lun->lun_se_dev)
return -ENODEV;

return core_alua_show_secondary_status(lun, page);
Expand All @@ -575,7 +575,7 @@ static ssize_t target_fabric_port_alua_tg_pt_status_store(
{
struct se_lun *lun = item_to_lun(item);

if (!lun || !lun->lun_se_dev)
if (!lun->lun_se_dev)
return -ENODEV;

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

if (!lun || !lun->lun_se_dev)
if (!lun->lun_se_dev)
return -ENODEV;

return core_alua_show_secondary_write_metadata(lun, page);
Expand All @@ -597,7 +597,7 @@ static ssize_t target_fabric_port_alua_tg_pt_write_md_store(
{
struct se_lun *lun = item_to_lun(item);

if (!lun || !lun->lun_se_dev)
if (!lun->lun_se_dev)
return -ENODEV;

return core_alua_store_secondary_write_metadata(lun, page, count);
Expand Down

0 comments on commit 9c6603e

Please sign in to comment.