All of lore.kernel.org
 help / color / mirror / Atom feed
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/9] net: macb: avoid uninitialized variables
Date: Thu, 28 Jan 2016 16:27:40 +0300	[thread overview]
Message-ID: <56AA174C.5010408@cogentembedded.com> (raw)
In-Reply-To: <1453903507-3427225-8-git-send-email-arnd@arndb.de>

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

WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Arnd Bergmann <arnd@arndb.de>, "David S. Miller" <davem@davemloft.net>
Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 7/9] net: macb: avoid uninitialized variables
Date: Thu, 28 Jan 2016 16:27:40 +0300	[thread overview]
Message-ID: <56AA174C.5010408@cogentembedded.com> (raw)
In-Reply-To: <1453903507-3427225-8-git-send-email-arnd@arndb.de>

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

  parent reply	other threads:[~2016-01-28 13:27 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 14:04 [PATCH 0/9] network driver fixes Arnd Bergmann
2016-01-27 14:04 ` Arnd Bergmann
2016-01-27 14:04 ` [PATCH 1/9] net: davinci_cpdma: use dma_addr_t for DMA address Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-27 14:04 ` [PATCH 2/9] net: hp100: remove unnecessary #ifdefs Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-27 14:04 ` [PATCH 3/9] net: bgmac: clarify CONFIG_BCMA dependency Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-27 16:11   ` Paul Gortmaker
2016-01-27 16:11     ` Paul Gortmaker
2016-01-27 16:11     ` Paul Gortmaker
2016-01-28  8:49     ` Arnd Bergmann
2016-01-28  8:49       ` Arnd Bergmann
2016-01-27 14:04 ` [PATCH 4/9] net: moxart: use correct accessors for DMA memory Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-28 12:36   ` David Laight
2016-01-28 12:36     ` David Laight
2016-01-28 16:53     ` Arnd Bergmann
2016-01-28 16:53       ` Arnd Bergmann
2016-01-28 16:58       ` Arnd Bergmann
2016-01-28 16:58         ` Arnd Bergmann
2016-01-27 14:04 ` [PATCH 5/9] net: fddi/defxx: avoid warning about uninitialized variable use Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-27 15:15   ` Maciej W. Rozycki
2016-01-27 15:15     ` Maciej W. Rozycki
2016-01-27 14:04 ` [PATCH 6/9] net: vxge: avoid unused function warnings Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-27 14:04 ` [PATCH 7/9] net: macb: avoid uninitialized variables Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-27 15:51   ` Nicolas Ferre
2016-01-27 15:51     ` Nicolas Ferre
2016-01-27 16:04     ` Nicolas Ferre
2016-01-27 16:04       ` Nicolas Ferre
2016-01-28 16:32       ` Arnd Bergmann
2016-01-28 16:32         ` Arnd Bergmann
2016-01-28 13:27   ` Sergei Shtylyov [this message]
2016-01-28 13:27     ` Sergei Shtylyov
2016-01-27 14:04 ` [PATCH 8/9] net: nb8800: avoid uninitialized variable warning Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-27 14:13   ` Måns Rullgård
2016-01-27 14:13     ` Måns Rullgård
2016-01-27 15:21     ` Arnd Bergmann
2016-01-27 15:21       ` Arnd Bergmann
2016-01-27 14:04 ` [PATCH 9/9] net: tg3: " Arnd Bergmann
2016-01-27 14:04   ` Arnd Bergmann
2016-01-29  0:14 ` [PATCH 0/9] network driver fixes David Miller
2016-01-29  0:14   ` David Miller
2016-01-29 12:56   ` Arnd Bergmann
2016-01-29 12:56     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56AA174C.5010408@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.