The parameter passed to ai_detach() is guaranteed to never be NULL
because it is checked by the caller. Consequently, the result of
container_of() on it is also never NULL, and a NULL check on it
is unnecessary. Even without that, the NULL check would still be
unnecessary because the subsequent kfree() can handle NULL arguments.
On top of all that, it is misleading to check the result of container_of()
against NULL because the position of the contained element could change,
which would make the check invalid. Remove it.
This change was made automatically with the following Coccinelle script.
t v = container_of(...);
v = container_of(...);
when != v
- if (\( !v \| v == NULL \) ) s
Signed-off-by: Guenter Roeck <[email protected]>
drivers/net/wireless/broadcom/brcm80211/brcmsmac/aiutils.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/aiutils.c
index 53365977bfd6..2084b506a450 100644
@@ -531,9 +531,6 @@ void ai_detach(struct si_pub *sih)
sii = container_of(sih, struct si_info, pub);
- if (sii == NULL)