From patchwork Thu Mar 9 17:42:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Korotkov X-Patchwork-Id: 67062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp432467wrd; Thu, 9 Mar 2023 10:01:23 -0800 (PST) X-Google-Smtp-Source: AK7set8XEzokiazCPyq+l9c3RuPiTP/0u5aCXyU4devnmArB1x8+YImJtpULY3PN5fzr+z2BJW66 X-Received: by 2002:a17:90b:1d81:b0:236:76bc:5081 with SMTP id pf1-20020a17090b1d8100b0023676bc5081mr23490062pjb.1.1678384883249; Thu, 09 Mar 2023 10:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678384883; cv=none; d=google.com; s=arc-20160816; b=UzpdLUZrQgwZkxkfK0XmVh08ruF0ECI4eApq/575bafGry0TSp3J7vd/EIne3c4RYG egtEKAR73AeCeqB8s/CMl9Fc0tCBucldg6iAO3il5qZMHRO903I1O36/gJoDaHAWVBGV 0mzGIGWz9YT01vE887NcjBfnqr/sboZ8YitxTb2WBmwdTknp34NY1ePbWOoV3UUc2KFy 0PkBfF3gaxK3GclLwYT8Dus9nI8InczIc0QTGp5z3bzg1K/GClsl8aBV6kE1tInCzyHI +0ixxbvgk4OWlvKPPB7sCWQWn5DUmbiLbUbpmj4irtQn9HLPsdzOoQHGbgtLU7fUomid ed3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=BApv3ZzPrK0APTfuigbevMtO/Zv45SBgwPL4CrgdF+c=; b=ihX5makFwW9H+UNIT3RGoBvMfwKAjmaWnwCBsWc7pVxD2vO4kwZT+HgiLJL/XYtk5b x936wD0/M11ZjNlLWdmB3yUOQMiPELQrLfaadu1yGwBddpRW6p6cCzzsSLTfIMu2BspC dgMHTOxH3Q9FQGpA71kUkh/wtAkLnZcqM3nPfGPIz1SEjyDBsQg/E/EPAPaktfIparlK a2mEu8HYT5ivA2qBarcO0dxI44JhYmqCYfBP+epOPETXMtof2COBQLWl14lNXstbhZ/w Sfo+l5TmG3Py2nRO5xLZ/eQKZpoCNxymTf9lvnbbV85RB78IfWvIwF0JLsiKIINCxUOk hEUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZiPNaYQQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a17090a710100b00233b8409d95si353498pjk.138.2023.03.09.10.01.08; Thu, 09 Mar 2023 10:01:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZiPNaYQQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbjCIRm6 (ORCPT + 99 others); Thu, 9 Mar 2023 12:42:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230144AbjCIRmz (ORCPT ); Thu, 9 Mar 2023 12:42:55 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB12CFAF88; Thu, 9 Mar 2023 09:42:52 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id f16so2650948ljq.10; Thu, 09 Mar 2023 09:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678383771; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BApv3ZzPrK0APTfuigbevMtO/Zv45SBgwPL4CrgdF+c=; b=ZiPNaYQQKEWtTKT7N27HEeTJmKfqE5QeplwlpgL45nt119pQObLctiw0GW9ELUTDwD SzIf8bhoukIt7kJX8vvkO6LlDjYrC0hQ/Uu/CFNH14cmfTjvBO/ZiiMA35nP1dlqnssg 95agUZ/5Nar3v5LxjFuOVUOCRbq76acOuwKNAuCNfBgWdjE6m6BDcAmJNvPoSsROCiSR zyY3NnjrMMGYSVL6SzDfMfBzV+dwd554aj6bVskSA8nkDjQ8HjLwA1QRK0fdtcKRw0oF kJ9hprEiDItj1LZddZwfOXpStQKXjmGYhHPf7/E3Qi/4UHBhnEhnG8wz2cmZHcdA9AEi m3uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678383771; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BApv3ZzPrK0APTfuigbevMtO/Zv45SBgwPL4CrgdF+c=; b=qfUAKxeraI8rwc0hoYVApgU9sB+iLb/nh1m74eEuiIC6av7+jDJomRsLGLa7eM4eMh nG/YRx1DrJ/gyHsom2kb/SNOc+TgOo0yxWLY1YmPzQ81PQzaCRfZ8et30Q9ltdR/2ozS 4kPHCdH249gpPZpwLl/uNIjvGFbA5UQXekspNVP7H4AdSlofIFAHDOHepjUHfhpRSkUX dk2x9iLCJdvxZh1mhplBRGnxhzdiANFnMeSq98G2I0byDq0fwnhzY3z0d1wItDUJOzTe 6zcz1CRqKfoEUW423UP/mZIVZrtKJUO8xQKQ1DNnSN06cZeQEjwgj7RRB2x2voiFQWi9 a/Ig== X-Gm-Message-State: AO0yUKX1tDUzyawwkDrbKydyDV16PUGUJ54ma48pKVtOVa32rIslIqs1 a8uIeR3iKcUt2g/eT3NwVm8= X-Received: by 2002:a2e:99c4:0:b0:293:3424:9d21 with SMTP id l4-20020a2e99c4000000b0029334249d21mr6932799ljj.45.1678383770747; Thu, 09 Mar 2023 09:42:50 -0800 (PST) Received: from mkor.. (89-109-45-204.dynamic.mts-nn.ru. [89.109.45.204]) by smtp.gmail.com with ESMTPSA id v21-20020a2e7a15000000b002945b04e1ebsm3036402ljc.94.2023.03.09.09.42.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 09:42:50 -0800 (PST) From: Maxim Korotkov To: Rasesh Mody Cc: Maxim Korotkov , GR-Linux-NIC-Dev@marvell.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Chan , Vadim Fedorenko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH net-next] bnx2: remove deadcode in bnx2_init_cpus() Date: Thu, 9 Mar 2023 20:42:31 +0300 Message-Id: <20230309174231.3135-1-korotkov.maxim.s@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759914107743182911?= X-GMAIL-MSGID: =?utf-8?q?1759914107743182911?= The load_cpu_fw function has no error return code and always returns zero. Checking the value returned by this function does not make sense. As a result, bnx2_init_cpus() will also return only zero Therefore, it will be safe to change the type of functions to void and remove checking Found by Security Code and Linux Verification Center (linuxtesting.org) with SVACE Signed-off-by: Maxim Korotkov --- drivers/net/ethernet/broadcom/bnx2.c | 31 +++++++--------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 9f473854b0f4..19b053c879b0 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -3829,7 +3829,7 @@ load_rv2p_fw(struct bnx2 *bp, u32 rv2p_proc, return 0; } -static int +static void load_cpu_fw(struct bnx2 *bp, const struct cpu_reg *cpu_reg, const struct bnx2_mips_fw_file_entry *fw_entry) { @@ -3897,48 +3897,34 @@ load_cpu_fw(struct bnx2 *bp, const struct cpu_reg *cpu_reg, val &= ~cpu_reg->mode_value_halt; bnx2_reg_wr_ind(bp, cpu_reg->state, cpu_reg->state_value_clear); bnx2_reg_wr_ind(bp, cpu_reg->mode, val); - - return 0; } -static int +static void bnx2_init_cpus(struct bnx2 *bp) { const struct bnx2_mips_fw_file *mips_fw = (const struct bnx2_mips_fw_file *) bp->mips_firmware->data; const struct bnx2_rv2p_fw_file *rv2p_fw = (const struct bnx2_rv2p_fw_file *) bp->rv2p_firmware->data; - int rc; /* Initialize the RV2P processor. */ load_rv2p_fw(bp, RV2P_PROC1, &rv2p_fw->proc1); load_rv2p_fw(bp, RV2P_PROC2, &rv2p_fw->proc2); /* Initialize the RX Processor. */ - rc = load_cpu_fw(bp, &cpu_reg_rxp, &mips_fw->rxp); - if (rc) - goto init_cpu_err; + load_cpu_fw(bp, &cpu_reg_rxp, &mips_fw->rxp); /* Initialize the TX Processor. */ - rc = load_cpu_fw(bp, &cpu_reg_txp, &mips_fw->txp); - if (rc) - goto init_cpu_err; + load_cpu_fw(bp, &cpu_reg_txp, &mips_fw->txp); /* Initialize the TX Patch-up Processor. */ - rc = load_cpu_fw(bp, &cpu_reg_tpat, &mips_fw->tpat); - if (rc) - goto init_cpu_err; + load_cpu_fw(bp, &cpu_reg_tpat, &mips_fw->tpat); /* Initialize the Completion Processor. */ - rc = load_cpu_fw(bp, &cpu_reg_com, &mips_fw->com); - if (rc) - goto init_cpu_err; + load_cpu_fw(bp, &cpu_reg_com, &mips_fw->com); /* Initialize the Command Processor. */ - rc = load_cpu_fw(bp, &cpu_reg_cp, &mips_fw->cp); - -init_cpu_err: - return rc; + load_cpu_fw(bp, &cpu_reg_cp, &mips_fw->cp); } static void @@ -4951,8 +4937,7 @@ bnx2_init_chip(struct bnx2 *bp) } else bnx2_init_context(bp); - if ((rc = bnx2_init_cpus(bp)) != 0) - return rc; + bnx2_init_cpus(bp); bnx2_init_nvram(bp);