linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2] rtc: pcf8563: fix uninitialized use warning
Date: Mon, 08 Sep 2014 19:43:44 +0400	[thread overview]
Message-ID: <540DCEB0.6030108@cogentembedded.com> (raw)
In-Reply-To: <2750370.rlMuFcoBUA@wuerfel>

On 9/8/2014 7:26 PM, Arnd Bergmann wrote:

> gcc-4.9 found a potential condition under which the 'pending'
> variable may be used uninitialized:

> drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_irq':
> drivers/rtc/rtc-pcf8563.c:173:5: warning: 'pending' may be used uninitialized in this function [-Wmaybe-uninitialized]

> This is because in the pcf8563_get_alarm_mode() function, we
> check any nonzero return of pcf8563_read_block_data, but
> in the irq function we only check for negative values, so
> a possible positive value does not get detected if the compiler
> chooses not to inline the entire call chain.

> Checking for any non-zero value in the interrupt handler as well
> is just as correct and lets the compiler know what we are doing,
> without needing a bogus initialization.

> As pointed out by Sergei Shtylyov, the same code section contains
> another bug: an interrupt handler is not supposed to return
> an errno value. Let's fix this as well by returning IRQ_NONE
> in case of a communication error.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    If you're fixing both issues in one patch, it probably needs somewhat 
modified subject, like "rtc: pcf8356: fix error handling".

WBR, Sergei

  reply	other threads:[~2014-09-08 15:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 15:26 [PATCHv2] rtc: pcf8563: fix uninitialized use warning Arnd Bergmann
2014-09-08 15:43 ` Sergei Shtylyov [this message]
2014-09-09 12:36   ` [PATCH v3 1/2] " Arnd Bergmann
2014-09-09 12:37   ` [PATCH v3 2/2] rtc: pcf8563: fix pcf8563_irq error return value 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=540DCEB0.6030108@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).