Skip to content

Commit 4691720

Browse files
ProjectMutilationkuba-moo
authored andcommitted
bnx2: remove deadcode in bnx2_init_cpus()
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. Now checking the value of the return value is misleading when reading the code. Path with error handling was deleted in 57579f7 ("bnx2: Use request_firmware()"). 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 to improving readability. Found by Security Code and Linux Verification Center (linuxtesting.org) with SVACE Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com> Link: https://lore.kernel.org/r/20230322162843.3452-1-korotkov.maxim.s@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 0c04328 commit 4691720

File tree

1 file changed

+8
-23
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+8
-23
lines changed

drivers/net/ethernet/broadcom/bnx2.c

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,7 @@ load_rv2p_fw(struct bnx2 *bp, u32 rv2p_proc,
38283828
return 0;
38293829
}
38303830

3831-
static int
3831+
static void
38323832
load_cpu_fw(struct bnx2 *bp, const struct cpu_reg *cpu_reg,
38333833
const struct bnx2_mips_fw_file_entry *fw_entry)
38343834
{
@@ -3896,48 +3896,34 @@ load_cpu_fw(struct bnx2 *bp, const struct cpu_reg *cpu_reg,
38963896
val &= ~cpu_reg->mode_value_halt;
38973897
bnx2_reg_wr_ind(bp, cpu_reg->state, cpu_reg->state_value_clear);
38983898
bnx2_reg_wr_ind(bp, cpu_reg->mode, val);
3899-
3900-
return 0;
39013899
}
39023900

3903-
static int
3901+
static void
39043902
bnx2_init_cpus(struct bnx2 *bp)
39053903
{
39063904
const struct bnx2_mips_fw_file *mips_fw =
39073905
(const struct bnx2_mips_fw_file *) bp->mips_firmware->data;
39083906
const struct bnx2_rv2p_fw_file *rv2p_fw =
39093907
(const struct bnx2_rv2p_fw_file *) bp->rv2p_firmware->data;
3910-
int rc;
39113908

39123909
/* Initialize the RV2P processor. */
39133910
load_rv2p_fw(bp, RV2P_PROC1, &rv2p_fw->proc1);
39143911
load_rv2p_fw(bp, RV2P_PROC2, &rv2p_fw->proc2);
39153912

39163913
/* Initialize the RX Processor. */
3917-
rc = load_cpu_fw(bp, &cpu_reg_rxp, &mips_fw->rxp);
3918-
if (rc)
3919-
goto init_cpu_err;
3914+
load_cpu_fw(bp, &cpu_reg_rxp, &mips_fw->rxp);
39203915

39213916
/* Initialize the TX Processor. */
3922-
rc = load_cpu_fw(bp, &cpu_reg_txp, &mips_fw->txp);
3923-
if (rc)
3924-
goto init_cpu_err;
3917+
load_cpu_fw(bp, &cpu_reg_txp, &mips_fw->txp);
39253918

39263919
/* Initialize the TX Patch-up Processor. */
3927-
rc = load_cpu_fw(bp, &cpu_reg_tpat, &mips_fw->tpat);
3928-
if (rc)
3929-
goto init_cpu_err;
3920+
load_cpu_fw(bp, &cpu_reg_tpat, &mips_fw->tpat);
39303921

39313922
/* Initialize the Completion Processor. */
3932-
rc = load_cpu_fw(bp, &cpu_reg_com, &mips_fw->com);
3933-
if (rc)
3934-
goto init_cpu_err;
3923+
load_cpu_fw(bp, &cpu_reg_com, &mips_fw->com);
39353924

39363925
/* Initialize the Command Processor. */
3937-
rc = load_cpu_fw(bp, &cpu_reg_cp, &mips_fw->cp);
3938-
3939-
init_cpu_err:
3940-
return rc;
3926+
load_cpu_fw(bp, &cpu_reg_cp, &mips_fw->cp);
39413927
}
39423928

39433929
static void
@@ -4950,8 +4936,7 @@ bnx2_init_chip(struct bnx2 *bp)
49504936
} else
49514937
bnx2_init_context(bp);
49524938

4953-
if ((rc = bnx2_init_cpus(bp)) != 0)
4954-
return rc;
4939+
bnx2_init_cpus(bp);
49554940

49564941
bnx2_init_nvram(bp);
49574942

0 commit comments

Comments
 (0)