Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320667 > unrolled thread

Re: [PATCH 7/9] net: macb: avoid uninitialized variables

Started bySergei Shtylyov <sergei.shtylyov@cogentembedded.com>
First post2016-01-28 14:30 +0100
Last post2016-01-28 14:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 7/9] net: macb: avoid uninitialized variables Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-01-28 14:30 +0100

#1320667 — Re: [PATCH 7/9] net: macb: avoid uninitialized variables

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2016-01-28 14:30 +0100
SubjectRe: [PATCH 7/9] net: macb: avoid uninitialized variables
Message-ID<qVUO5-3Yo-5@gated-at.bofh.it>
Hello.

On 1/27/2016 5:04 PM, Arnd Bergmann wrote:

> The macb_clk_init function returns three clock pointers, unless
> the it fails to get the first ones. We correctly handle the

    s/the//.

> failure case by propagating the error from macb_probe, but
> gcc does not realize this and incorrectly warns about a later
> use of those:
>
> In file included from /git/arm-soc/drivers/net/ethernet/cadence/macb.c:12:0:
> drivers/net/ethernet/cadence/macb.c: In function 'macb_probe':

    Hm, didn't these 2 lines get swapped by chance?

> include/linux/clk.h:484:2: error: 'tx_clk' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    clk_disable(clk);
>    ^
> drivers/net/ethernet/cadence/macb.c:2822:28: note: 'tx_clk' was declared here
>    struct clk *pclk, *hclk, *tx_clk;
>                              ^
> In file included from /git/arm-soc/drivers/net/ethernet/cadence/macb.c:12:0:
> include/linux/clk.h:484:2: error: 'hclk' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    clk_disable(clk);
>    ^
> drivers/net/ethernet/cadence/macb.c:2822:21: note: 'hclk' was declared here
>    struct clk *pclk, *hclk, *tx_clk;
>                       ^
>
> This shuts up the misleading warnings by ensuring that the
> macb_clk_init() always stores something into all three pointers.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

[...]

MBR, Sergei

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web