target: testing for NULL instead of IS_ERR
Subsystems (2)
PATCH 1/1 target: testing for NULL instead of IS_ERR
core_tpg_alloc_lun() returns ERR_PTRs, it never returns NULL.
Fixes b865ae297e42 ('target: Convert se_portal_group->tpg_lun_list[] to RCU hlist')
Signed-off-by Dan Carpenter <[email protected]>
drivers/target/target_core_fabric_configfs.c +2 -2
@@ -898,8 +898,8 @@ static struct config_group *target_fabric_make_lun(return ERR_PTR (-EINVAL ); lun =core_tpg_alloc_lun (se_tpg, unpacked_lun); -if (!lun) -return ERR_PTR (-ENOMEM ); +if (IS_ERR (lun)) +return ERR_CAST (lun); lun_cg = &lun->lun_group; lun_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
Nicholas A. Bellinger
AppliedQuoted 11 lines · Dan Carpenter
core_tpg_alloc_lun()returnsERR_PTRs, it never returns NULL.Fixes b865ae297e42 ('target: Convert se_portal_group->tpg_lun_list[] to RCU hlist')Signed-off-by Dan Carpenter <[email protected]>drivers/target/target_core_fabric_configfs.c +0
-0@@ -898,8 +898,8 @@ static struct config_group *target_fabric_make_lun(return ERR_PTR (-EINVAL );
drivers/target/target_core_fabric_configfs.c static struct config_group *target_fabric_make_lun(
Quoted 10 lines
drivers/target/target_core_fabric_configfs.c +2
-3lun =core_tpg_alloc_lun (se_tpg, unpacked_lun); -if (!lun) -return ERR_PTR (-ENOMEM ); +if (IS_ERR (lun)) +return ERR_CAST (lun); lun_cg = &lun->lun_group; lun_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2, --
Applied to for-next, and will squash into the original commit soon.
Thanks Dan!
--nab