Message ID | 20200803210949.16070-1-xypron.glpk@gmx.de |
---|---|
State | Accepted, archived |
Commit | 6a43e3a16743e5fc5b765bf897691b630e3e1edb |
Headers | show |
Series | [1/1] riscv: sifive: fu540: redundant initialization | expand |
On Tue, Aug 4, 2020 at 5:10 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote: > > We should not initialize a variable if the value is overwritten before > being read. > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > arch/riscv/cpu/fu540/cache.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Reviewed-by: Bin Meng <bin.meng@windriver.com>
>-----Original Message----- >From: Heinrich Schuchardt <xypron.glpk@gmx.de> >Sent: 04 August 2020 02:40 >To: Rick Chen <rick@andestech.com> >Cc: Pragnesh Patel <pragnesh.patel@sifive.com>; Bin Meng ><bmeng.cn@gmail.com>; u-boot@lists.denx.de; Heinrich Schuchardt ><xypron.glpk@gmx.de> >Subject: [PATCH 1/1] riscv: sifive: fu540: redundant initialization > >[External Email] Do not click links or attachments unless you recognize the >sender and know the content is safe > >We should not initialize a variable if the value is overwritten before being read. > >Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> >--- > arch/riscv/cpu/fu540/cache.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com> Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>
> From: Heinrich Schuchardt [mailto:xypron.glpk@gmx.de] > Sent: Tuesday, August 04, 2020 5:10 AM > To: Rick Jian-Zhi Chen(陳建志) > Cc: Pragnesh Patel; Bin Meng; u-boot@lists.denx.de; Heinrich Schuchardt > Subject: [PATCH 1/1] riscv: sifive: fu540: redundant initialization > > We should not initialize a variable if the value is overwritten before being read. > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > arch/riscv/cpu/fu540/cache.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Rick Chen <rick@andestech.com>
diff --git a/arch/riscv/cpu/fu540/cache.c b/arch/riscv/cpu/fu540/cache.c index 9ee364b509..54de14238c 100644 --- a/arch/riscv/cpu/fu540/cache.c +++ b/arch/riscv/cpu/fu540/cache.c @@ -22,7 +22,7 @@ DECLARE_GLOBAL_DATA_PTR; int cache_enable_ways(void) { const void *blob = gd->fdt_blob; - int node = (-FDT_ERR_NOTFOUND); + int node; fdt_addr_t base; u32 config; u32 ways;
We should not initialize a variable if the value is overwritten before being read. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> --- arch/riscv/cpu/fu540/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.27.0