2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-24 21:24:00 +08:00

target/configfs: Remove unnecessary null test

This patch removes the null test on lun_cg. lun_cg is initialized
at the beginning of the function to &lun->lun_group. Since lun_cg is
dereferenced prior to the null test, it must be a valid pointer.

The following Coccinelle script is used for detecting the change:

@r@
expression e,f;
identifier g,y;
statement S1,S2;
@@

*e = &f->g
<+...
 f->y
 ...+>
*if (e != NULL || ...)
 S1 else S2

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
Himangi Saraogi 2014-07-17 02:29:53 +05:30 committed by Nicholas Bellinger
parent 9e82bf0141
commit e1ea97fef0

View File

@ -917,8 +917,7 @@ static struct config_group *target_fabric_make_lun(
return &lun->lun_group;
out:
if (lun_cg)
kfree(lun_cg->default_groups);
kfree(lun_cg->default_groups);
return ERR_PTR(errno);
}