[PATCH][V2] net: dsa: b53: remove redundant null check on dev
From: Colin King
Date: Tue Jun 15 2021 - 05:05:23 EST
From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
The pointer dev can never be null, the null check is redundant
and can be removed. Cleans up a static analysis warning that
pointer priv is dereferencing dev before dev is being null
checked.
Addresses-Coverity: ("Dereference before null check")
Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
---
V2: Remove null check rather than add b53_srab_intr_set call into a null
check statement block.
Rephrase commit Subject to reflect the change in the fix.
---
drivers/net/dsa/b53/b53_srab.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c
index aaa12d73784e..3f4249de70c5 100644
--- a/drivers/net/dsa/b53/b53_srab.c
+++ b/drivers/net/dsa/b53/b53_srab.c
@@ -632,8 +632,7 @@ static int b53_srab_remove(struct platform_device *pdev)
struct b53_srab_priv *priv = dev->priv;
b53_srab_intr_set(priv, false);
- if (dev)
- b53_switch_remove(dev);
+ b53_switch_remove(dev);
return 0;
}
--
2.31.1