From: Andrew Morton <akpm@linux-foundation.org>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: a.zummo@towertech.it, grant.likely@linaro.org,
robh+dt@kernel.org, rtc-linux@googlegroups.com,
linux-kernel@vger.kernel.org
Subject: Re: question about drivers/rtc/rtc-cmos.c
Date: Fri, 27 Dec 2013 14:22:55 -0800 [thread overview]
Message-ID: <20131227142255.c6b1b7e92a8430f1bebd15af@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1312252028170.2020@localhost6.localdomain6>
On Wed, 25 Dec 2013 20:32:12 +0100 (CET) Julia Lawall <julia.lawall@lip6.fr> wrote:
> The function cmos_do_probe contains the code:
>
> if (is_hpet_enabled()) {
> int err;
>
> rtc_cmos_int_handler = hpet_rtc_interrupt;
> err = hpet_register_irq_handler(cmos_interrupt);
> if (err != 0) {
> dev_warn(dev, "hpet_register_irq_handler "
> " failed in rtc_init().");
> goto cleanup1;
> }
> }
>
> Is it intentional that the error code returned by
> hpet_register_irq_handler is put ina local variable that will not be seen
> at label cleanup1? The return value is retval, which is 0 at this point.
No, I'd say that's a bug. How does this look?
From: Andrew Morton <akpm@linux-foundation.org>
Subject: drivers/rtc/rtc-cmos.c: propagate hpet_register_irq_handler() failure
If hpet_register_irq_handler() fails, cmos_do_probe() will incorrectly
return 0.
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/rtc/rtc-cmos.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff -puN drivers/rtc/rtc-cmos.c~drivers-rtc-rtc-cmosc-propagate-hpet_register_irq_handler-failure drivers/rtc/rtc-cmos.c
--- a/drivers/rtc/rtc-cmos.c~drivers-rtc-rtc-cmosc-propagate-hpet_register_irq_handler-failure
+++ a/drivers/rtc/rtc-cmos.c
@@ -708,11 +708,9 @@ cmos_do_probe(struct device *dev, struct
irq_handler_t rtc_cmos_int_handler;
if (is_hpet_enabled()) {
- int err;
-
rtc_cmos_int_handler = hpet_rtc_interrupt;
- err = hpet_register_irq_handler(cmos_interrupt);
- if (err != 0) {
+ retval = hpet_register_irq_handler(cmos_interrupt);
+ if (retval) {
dev_warn(dev, "hpet_register_irq_handler "
" failed in rtc_init().");
goto cleanup1;
_
next prev parent reply other threads:[~2013-12-27 22:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-25 19:32 Julia Lawall
2013-12-27 17:29 ` Alessandro Zummo
2013-12-27 20:26 ` Julia Lawall
2013-12-27 22:22 ` Andrew Morton [this message]
2013-12-27 22:32 ` Julia Lawall
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=20131227142255.c6b1b7e92a8430f1bebd15af@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=a.zummo@towertech.it \
--cc=grant.likely@linaro.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=rtc-linux@googlegroups.com \
/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
all inboxes | Powered by JetHome®