From patchwork Sun Feb 11 15:08:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniil Dulov X-Patchwork-Id: 199471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1969147dyd; Sun, 11 Feb 2024 07:10:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgKpUqfKa1dYseHOmyDyFqEH/CrQnR9SAPDUCjNqRC9c5M494lrKOdcAOOYb8Mj6ZUpbuV X-Received: by 2002:a17:907:7d9f:b0:a38:567a:6574 with SMTP id oz31-20020a1709077d9f00b00a38567a6574mr7032513ejc.5.1707664252309; Sun, 11 Feb 2024 07:10:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707664252; cv=pass; d=google.com; s=arc-20160816; b=rKQKROzlAH6uwZ6VF6E/JchNfYCUvA8yZwWQ/wHd9ofeIs7rOh6CWFFZD+kRpKyjve mSgmjddhD+jkkFOBVxAkj2IEf4hwoamkG64s21eG8i4d7CFVEGvEUOaqirpeTt/ISwr2 ZEt+dn3a319iW1g9y4Ydz9Eu7sa7YDTczzQqIt9R2ZWkknH88TKFCLgj1AeghOD3svOC NR6+LLcQB1e+PUaPEDgKKjlcWNC6a/1/IbVaaZlH4KeIDcryCvMFC8E4hwGBOmA27NOk fW4rI3J8jvPQm4PsSjZ2Lv2BAd3xij+/KbVuS/8r4BIkOAFFYV+9HbsF76hMpnEmcDwR Y6dQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=0O2hKbD7cQmxHYdkkdX6GGn7xZswdwjGGX1DQCekUIw=; fh=AseSFVOfXS1LGltDMceHkfaA6dKn9arjDYpznq2nKYQ=; b=hZXhFSImFIzdfyuYXSE/Rthw2o1TGAJDD7mBfW1Bk0W7p1dkzfoMsXfkjGb3XpNKCF Jd7bOQj1lrxG8zw26SyApP+viotMLefVH6+88DhtGYOG/bRmTtBBJJY6zlecZRd45pMj K4wzhsskpUsrXTeHpf0T917u7RbT/0EABniUH95MV/X0YpwvgdGRBPpkrSjEt/hPrWxE +fsX88NYWpVfOOxb3IlZgNa25fXV7I1CJlPWlMPVwI4CUnIUb9cPMJtuShd/uL+nyytU PB0gOYBLq6rwRifiGsChU2/SUgf9ESvq6Yo/p31iKM3Dlhtong4xVpg7p9IgbbgU6bRX h5KQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60823-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60823-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCVyXU5UEbGLDHWCPqKyl4t2gmrqM2biZHC0MKQCTevm5HGOLrxRlj3JaHKddYBgHoV06dRe+QM/0fwqLJdwivCqKtpUQw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f27-20020a170906139b00b00a3c9aacbae5si138006ejc.941.2024.02.11.07.10.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:10:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60823-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60823-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60823-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E786E1F21DA0 for ; Sun, 11 Feb 2024 15:10:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 927745EE6D; Sun, 11 Feb 2024 15:08:35 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40E155B695; Sun, 11 Feb 2024 15:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664114; cv=none; b=JGXrq6RXnNcztDo2+LCkF2EB/BT0OnCvs8WTTyUAQ1OSHy+KWHJaeq60XMC+CISBavhmYyUf2lGJBzbYAERzvkhfut3+O0SBn9FCni6n32yNGWdGzGaZEvQAkUSFcT2mv/IfMV2p5Nyao19JdWpDNVmFenYLM0GAgck68kYWPRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664114; c=relaxed/simple; bh=IvTIcU18qlQtiOl7Wv/JqJLqq3hP94HFMtbZnDwMaw8=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=N8Mok1nYCacgfM5QQoU3i9+bi+o39ZzMhTk3veK0NrTiYGSgTpP+jKbtHLdVuhOeJxqC2EVGl7SQvI1uXx95mZEoCggJqH1+K5ZF2q65QNizf5uFm+Os8aWO5LW+GdhzRsuVdhLBsV0DuV8//FrGKqDCU11KsSlPJx2rtGCzrA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: Russell King CC: Daniil Dulov , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Jakub Kicinski , , , Subject: [PATCH] net: sfp: remove redundant NULL check Date: Sun, 11 Feb 2024 07:08:24 -0800 Message-ID: <20240211150824.3947-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EXCH-2016-02.aladdin.ru (192.168.1.102) To EXCH-2016-01.aladdin.ru (192.168.1.101) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790615750687136537 X-GMAIL-MSGID: 1790615750687136537 bus->upstream_ops in sfp_register_bus() cannot be NULL. So remove redundant NULL check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: ce0aa27ff3f6 ("sfp: add sfp-bus to bridge between network devices and sfp cages") Signed-off-by: Daniil Dulov --- drivers/net/phy/sfp-bus.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c index 850915a37f4c..829cb1dccc27 100644 --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c @@ -478,14 +478,12 @@ static int sfp_register_bus(struct sfp_bus *bus) const struct sfp_upstream_ops *ops = bus->upstream_ops; int ret; - if (ops) { - if (ops->link_down) - ops->link_down(bus->upstream); - if (ops->connect_phy && bus->phydev) { - ret = ops->connect_phy(bus->upstream, bus->phydev); - if (ret) - return ret; - } + if (ops->link_down) + ops->link_down(bus->upstream); + if (ops->connect_phy && bus->phydev) { + ret = ops->connect_phy(bus->upstream, bus->phydev); + if (ret) + return ret; } bus->registered = true; bus->socket_ops->attach(bus->sfp);