From patchwork Thu May 13 23:04:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 12256821 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 D0128C433ED for ; Thu, 13 May 2021 23:21:07 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4EE656141F for ; Thu, 13 May 2021 23:21:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EE656141F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=NO5OUsp0xjAhJHtznMWdcJ39XBzow9rufL5IoXSuwe0=; b=MsUm47OYD8aADqvXvEaUDgYhzk 3orKr7LjVa+JnaFF5UztOYg1kHpKs+TJYTCfUSU0Z85ZJ+bVIhtj38WmetxE3A85lGd3BXldYrXqW VmxeBN1D1k1215y/9bKcr05ve0z6es0U1/zJWhQmgfNML98LH31yuFqpQKIycO0haNqnAiIQMKBEa mRfDkHLMSdwhIrQsGdRgo3FlQYsQ3MeH4OOLtb84+86CUHPJxje9e387caFZzPTyv55Ao2v0HsnQV TcZaE68lLdGONQ28d7lFfKtg643Slz93wHZ9b5zCeamQ7UU4F6m+tyfNhS8wXi0guhG3ufq7lDtOe eIk/eT5w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lhKb3-006eTF-5e; Thu, 13 May 2021 23:18:27 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhKNZ-006cVf-4v for linux-arm-kernel@desiato.infradead.org; Thu, 13 May 2021 23:04:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=5kzGv2iHn3/izMP0DDwAFYLuDgOh/guXF9UGZskZqcA=; b=SG+U+iulG4ENpII1jI8SDaUzX/ dHwu4GuFbNefd/TfUMrLgHGabOLbYOtk+8wBEGTNzRVOAOuxWucKoq/F3zKicHzYBn2b3LLghykWp i52rmslnc3E8flyJLmq3DvMPUPkUUUXe1DdtKFPMUwC6juKz8cGTFr4hg2+SaZ0jeo8LsoEQjsxcB 2ktxLoy2mOS/Ct5O/BF+hqcFo2NNMhptNC9PH0jgyRCyreo/DHCROv6obL78Mj3Ax3xJE5WNYZ2Ov KmGvjN+7R4tb0vjWAA5M/TaTjqQGTtBx81F5rmgqdSx8MCAY07MMb+kTMhZQwwEhVtmbyHzv+ZFgl iPDonqFA==; Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhKNV-00Bavu-Jy for linux-arm-kernel@lists.infradead.org; Thu, 13 May 2021 23:04:26 +0000 Received: by mail-qt1-x833.google.com with SMTP id k19so1642258qta.2 for ; Thu, 13 May 2021 16:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5kzGv2iHn3/izMP0DDwAFYLuDgOh/guXF9UGZskZqcA=; b=O1vf/f+ODXtfZGn96zPUqp//RnUao9fUXDvHrlog5lZWU+H7RSWVWfjyIy7LQsDRpx m+jUMBWid8DhWQ0H33cccpXYzZ+KrEsFHB/g9AniiZtIIn27t4R1TeaOvZW11KrmpgAx wSsyV/pCZTHdPIpPxEImwGjijmMFgBbpDk/o5ys3LmYx/ztU+/UYntcjfjs0TY6PBnRG CFmt/6qEB5/vsVCXJSoq2g1C0JPD8/29L7xueyB/ZI98kJsTPrazHuYv6L1nknKUOKbk FNLxkcllLtke71XF5zXxBvQZkHzcWwTG0y8Dm4/ASthZ/yiAHZVilUt/545byrrtZvrE /Y8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=5kzGv2iHn3/izMP0DDwAFYLuDgOh/guXF9UGZskZqcA=; b=CPv9Uvyew3+Ri/BfKkJkUv4FPUgaMR1kHFMrP/qgTXfDiW0TYoCYxsi6lIbKOHHbeu vWrCDfk4yaUfqSPgGvAqF94cJevgm3VZgseBncOlpf6VMSKZ5v4qsArFbr9nslk+jka2 xh49P/q45S3lFU3FwxPxgsJFBdhIa7jPb51uz/2Q4QdijO1sNZq6g+6qWEROPI7U5Feg KkSXSdLVSUuS0n5Bj3Jz/NqOWTNs5thFjqzHSxtNENMTwlWzqrn2URKesGzEnAABxouM 3MUdiGnQ14p37Kkmbtao2zjp2iVZz1Vys8A5xYarMMLocWTaqrppPRfprNLXso7eep1q Scdw== X-Gm-Message-State: AOAM533Id/cLkszg5PgjXY/nVUzYpReafJnDxOoiwjW5MoFNNfQ1UY45 DrEChUSKb7UCr3+qNVY73nw= X-Google-Smtp-Source: ABdhPJxnkxR+M1U0M94Ymqr53S/ioF5VF/Ku5cKgBGXmgRy1b1vAUJBILvMaHfSJcbfs3QO9nkSVqQ== X-Received: by 2002:ac8:5250:: with SMTP id y16mr31833537qtn.36.1620947061477; Thu, 13 May 2021 16:04:21 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id s10sm3352037qkj.77.2021.05.13.16.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 16:04:20 -0700 (PDT) From: Guenter Roeck To: Sunil Goutham Cc: "David S . Miller" , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH] net: thunderx: Drop unnecessary NULL check after container_of Date: Thu, 13 May 2021 16:04:18 -0700 Message-Id: <20210513230418.919219-1-linux@roeck-us.net> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210513_160425_697196_A81AE463 X-CRM114-Status: GOOD ( 10.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The result of container_of() operations is never NULL unless the embedded element is the first element of the structure. This is not the case here. The NULL check is therefore unnecessary and misleading. Remove it. This change was made automatically with the following Coccinelle script. @@ type t; identifier v; statement s; @@ <+... ( t v = container_of(...); | v = container_of(...); ) ... when != v - if (\( !v \| v == NULL \) ) s ...+> Signed-off-by: Guenter Roeck --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 0c783aadf393..c36fed9c3d73 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -594,9 +594,6 @@ static void bgx_lmac_handler(struct net_device *netdev) struct phy_device *phydev; int link_changed = 0; - if (!lmac) - return; - phydev = lmac->phydev; if (!phydev->link && lmac->last_link)