From patchwork Sun Feb 19 15:22:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Korotkov X-Patchwork-Id: 59183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp895135wrn; Sun, 19 Feb 2023 07:28:26 -0800 (PST) X-Google-Smtp-Source: AK7set/K+HrBBeWNEsMloHYqrFBClObhhgtAcwZMWjRAsTe4enTANhstd6WCMgz6bsfoc6CGTZdT X-Received: by 2002:a05:6a20:8416:b0:c7:13bf:3fd0 with SMTP id c22-20020a056a20841600b000c713bf3fd0mr17359071pzd.25.1676820506571; Sun, 19 Feb 2023 07:28:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676820506; cv=none; d=google.com; s=arc-20160816; b=jnusrQRJY/Ac73Scq+dPSY6T1HN06uw2EIrmhUozUlQ+Ot2UKjkrtMoJEip/V2X3sp sHXKlKmhcKFRLEySc7tA8zXY53+ps8AEfm6tMtEQ4Z8kJxfWP/Geu6htkMEbgW5Gltym 3KSSlLgp1xQGAcJg7nzJH76XE+hi6MNcteAOowX4Y7U2g/v9/4fnxZi4Ylac7HwS4fKi YX74zvVjx3uoQ6RXpy5T00ccruOwIpv8veYOGrbS+E7jzf6wSRRvCB0eJNRTedFadChM 9cHXT0BkUo0GN5v0ReQLKdb4sGy5Evz2Z5O0XS+S063vNdBLzAFbVRyZJJ++zz7w+4Zh nFig== 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=FcOM6cXhM0TQxn7f1e5bkETMl7oG+G75JRDm4X4TtcE=; b=CBdE2IPbsOCr+Mt+CPrpHevuaCd/geHMz45xj3/TBp/49ZYCS1q5dHjiuuVeLwnNKo W3kKVW/kmjAQaXmUh6kj0hXFRSyNnYgjZtq6KWQVqRpash5ukCo5VHd09PI/fO68Be8a M7kqpmRCEeeV6mIFNEj8NIvvWVK5yy8k8pHsw5Nyv1auedhTpuMmJMcDnpoZa+nVMBdO XmiptMA66HtmnA6zZb8Lny2jSH/lN8imCNZoNy6EFq19Pq9/+e0SMNkfttGoYr263UoL bXQZZwhqLyeidrRZyjnHRNHWaE7eiAbpUfImbVQLYHwRcfK6lVTqMwqzz2s1IaD/XieD KUhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FsqXCtrN; 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 b75-20020a621b4e000000b005a8bebbdb3esi243791pfb.105.2023.02.19.07.28.11; Sun, 19 Feb 2023 07:28:26 -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=FsqXCtrN; 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 S230239AbjBSPXF (ORCPT + 99 others); Sun, 19 Feb 2023 10:23:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbjBSPXE (ORCPT ); Sun, 19 Feb 2023 10:23:04 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEAC57DBB; Sun, 19 Feb 2023 07:23:02 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id be16so1010830lfb.9; Sun, 19 Feb 2023 07:23:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FcOM6cXhM0TQxn7f1e5bkETMl7oG+G75JRDm4X4TtcE=; b=FsqXCtrNZ8seRhzWnVi3WWD7TD7GYRRqx6LV7izcyfuXpuTV/SkAKnZnxxPvuTVqU2 GdeY4x4phxkUP92214YoYKZDqdJEr4lkNu1jorttf8s9h1mVmmNMwD3K39K80xH7x/nz DyVsE1XfxvBO4IyW8DdG1AjJamqS8rwLC+PRB306PXhYie8aBZOGXccpd6gz8v8zXmoI 93KqKh5yoV41GFOI7z2WQq8gFWw990NcCcASEbXoW8AfdiB4ebSqHnqj55FmtP6g7pL/ 3xTUFJrevWIhP1WE8njOVMVmx3G8+01wyPuyVUp1FsqnL+zE6Z/q2RLjBFtgQX/CMo87 TWrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=FcOM6cXhM0TQxn7f1e5bkETMl7oG+G75JRDm4X4TtcE=; b=iEIyb+WEmA+HyluIWrxJo60isepPJLRc5IBWj+JjZxT2Qwh5bK6m9SlwWYbti1tXW8 GSNAOzCGmEIOG7uo5ZNO32hG+VEAhdRQQF3sJcVc6R3mIAY1isT3xeH8RMcl+nHMHqSP PM2pTM2+6VYqXwhVAZc89MBjDwVOBT20AArB60K0pH/mhgY9SAIT0YOPYU5n6YlqV4OD 0pujRtAn0arCCMsUobNQYCsZf6/R5ZYX0dOMmHJklfJzEVf5PMseCm3TB+t1333P8kAm FZeCl/M69INggN0MSQvTgD0ztZ7ddhAszl/vDMBCBt/RH7+SugiwWPunkoh8EH5asTPI XNgg== X-Gm-Message-State: AO0yUKXGK0vxb47RkVijp1G7njJBOfYhki/gUtuM6OMEcp2gippBdLok Cth48FPAecMd6K1noKRvBtI= X-Received: by 2002:a19:700b:0:b0:4dc:7ff4:83f9 with SMTP id h11-20020a19700b000000b004dc7ff483f9mr87991lfc.16.1676820180888; Sun, 19 Feb 2023 07:23:00 -0800 (PST) Received: from mkor.. (89-109-49-189.dynamic.mts-nn.ru. [89.109.49.189]) by smtp.gmail.com with ESMTPSA id f25-20020ac25339000000b004d865c781eesm58959lfh.24.2023.02.19.07.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 07:23:00 -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 v2] bnx2: remove deadcode in bnx2_init_cpus() Date: Sun, 19 Feb 2023 18:22:25 +0300 Message-Id: <20230219152225.3339-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?1758273739442916170?= X-GMAIL-MSGID: =?utf-8?q?1758273739442916170?= 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 Fixes: 57579f7629a3 ("bnx2: Use request_firmware()") Signed-off-by: Maxim Korotkov Reviewed-by: Leon Romanovsky --- changes v2: - bnx2_init_cpu_fw() and bnx2_init_cpus() are void - delete casts to void - remove check of bnx2_init_cpus() in bnx2_init_chip() 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);