diff mbox series

[V2] net: dsa: b53: remove redundant null check on dev

Message ID 20210615090516.5906-1-colin.king@canonical.com (mailing list archive)
State Accepted
Commit 11b57faf951cd3a570e3d9e463fc7c41023bc8c6
Delegated to: Netdev Maintainers
Headers show
Series [V2] net: dsa: b53: remove redundant null check on dev | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Colin King June 15, 2021, 9:05 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

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@canonical.com>
---

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(-)

Comments

Florian Fainelli June 15, 2021, 2:10 p.m. UTC | #1
On 6/15/2021 2:05 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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@canonical.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
patchwork-bot+netdevbpf@kernel.org June 15, 2021, 6:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 15 Jun 2021 10:05:16 +0100 you wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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.
> 
> [...]

Here is the summary with links:
  - [V2] net: dsa: b53: remove redundant null check on dev
    https://git.kernel.org/netdev/net-next/c/11b57faf951c

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

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;
 }