From patchwork Tue Jun 15 09:05:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 12320761 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC28FC48BE5 for ; Tue, 15 Jun 2021 09:05:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B022861429 for ; Tue, 15 Jun 2021 09:05:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231328AbhFOJHZ (ORCPT ); Tue, 15 Jun 2021 05:07:25 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51627 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbhFOJHY (ORCPT ); Tue, 15 Jun 2021 05:07:24 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lt50W-0003X9-Qg; Tue, 15 Jun 2021 09:05:16 +0000 From: Colin King To: Florian Fainelli , Andrew Lunn , Vivien Didelot , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][V2] net: dsa: b53: remove redundant null check on dev Date: Tue, 15 Jun 2021 10:05:16 +0100 Message-Id: <20210615090516.5906-1-colin.king@canonical.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Colin Ian King 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 Acked-by: Florian Fainelli --- 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; }