lkml.org 
[lkml]   [2019]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] net: stmmac: Variable "val" in function sun8i_dwmac_set_syscon() could be uninitialized
Thanks, but why initialization matters here? Is performance the main concern?


On Wed, Feb 6, 2019 at 9:52 PM Yizhuo Zhai <yzhai003@ucr.edu> wrote:
>
> Thanks, but why initialization matters here? Is performance the main concern?
>
> On Wed, Feb 6, 2019 at 8:17 PM David Miller <davem@davemloft.net> wrote:
>>
>> From: Yizhuo <yzhai003@ucr.edu>
>> Date: Tue, 5 Feb 2019 14:15:59 -0800
>>
>> > @@ -639,9 +639,14 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
>> > struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
>> > struct device_node *node = priv->device->of_node;
>> > int ret;
>> > - u32 reg, val;
>> > + u32 reg, val = 0;
>> > +
>> > + ret = regmap_read(gmac->regmap, SYSCON_EMAC_REG, &val);
>> > + if (ret) {
>> > + dev_err(priv->device, "Fail to read SYSCON_EMAC_REG.\n");
>> > + return ret;
>> > + }
>>
>> I agree with the other reviewer that since you check 'ret' the initialization of
>> 'val' is no longer needed.
>
>
>
> --
> Kind Regards,
>
> Yizhuo Zhai
>
> Computer Science, Graduate Student
> University of California, Riverside



--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

\
 
 \ /
  Last update: 2019-02-07 06:54    [W:0.104 / U:1.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site