* Re: rtc/m41t80: use rtc_valid_tm() to check returned tm
[not found] <201008111659.o7BGxn4g029524@hera.kernel.org>
@ 2010-08-12 21:27 ` Geert Uytterhoeven
2010-08-13 1:43 ` Wan ZongShun
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2010-08-12 21:27 UTC (permalink / raw)
To: Wan ZongShun, Andrew Morton; +Cc: Alessandro Zummo, Linux Kernel Mailing List
On Wed, Aug 11, 2010 at 18:59, Linux Kernel Mailing List
<linux-kernel@vger.kernel.org> wrote:
> Gitweb: http://git.kernel.org/linus/b485fe5ea1008db02abff9ef15be4f31b52df4f7
> rtc/m41t80: use rtc_valid_tm() to check returned tm
>
> Use rtc_valid_tm() to check returned struct rtc_time *tm - it can avoid
> returning wrong tm value.
> diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
> index 6dc4e62..66377f3 100644
> --- a/drivers/rtc/rtc-m41t80.c
> +++ b/drivers/rtc/rtc-m41t80.c
> @@ -364,7 +364,7 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t)
> t->time.tm_isdst = -1;
> t->enabled = !!(reg[M41T80_REG_ALARM_MON] & M41T80_ALMON_AFE);
> t->pending = !!(reg[M41T80_REG_FLAGS] & M41T80_FLAGS_AF);
> - return 0;
> + return rtc_valid_tm(t);
warning: passing argument 1 of ‘rtc_valid_tm’ from incompatible pointer type
`t' is of type `struct rtc_wkalrm *', not `struct rtc_time *'.
Probably the intention was:
return rtc_valid_tm(&t->time);
??
> }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rtc/m41t80: use rtc_valid_tm() to check returned tm
2010-08-12 21:27 ` rtc/m41t80: use rtc_valid_tm() to check returned tm Geert Uytterhoeven
@ 2010-08-13 1:43 ` Wan ZongShun
2010-08-17 14:05 ` Atsushi Nemoto
0 siblings, 1 reply; 4+ messages in thread
From: Wan ZongShun @ 2010-08-13 1:43 UTC (permalink / raw)
To: Geert Uytterhoeven, Andrew Morton
Cc: Alessandro Zummo, Linux Kernel Mailing List
2010/8/13 Geert Uytterhoeven <geert@linux-m68k.org>:
> On Wed, Aug 11, 2010 at 18:59, Linux Kernel Mailing List
> <linux-kernel@vger.kernel.org> wrote:
>> Gitweb: http://git.kernel.org/linus/b485fe5ea1008db02abff9ef15be4f31b52df4f7
>
>> rtc/m41t80: use rtc_valid_tm() to check returned tm
>>
>> Use rtc_valid_tm() to check returned struct rtc_time *tm - it can avoid
>> returning wrong tm value.
>
>> diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
>> index 6dc4e62..66377f3 100644
>> --- a/drivers/rtc/rtc-m41t80.c
>> +++ b/drivers/rtc/rtc-m41t80.c
>
>> @@ -364,7 +364,7 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t)
>> t->time.tm_isdst = -1;
>> t->enabled = !!(reg[M41T80_REG_ALARM_MON] & M41T80_ALMON_AFE);
>> t->pending = !!(reg[M41T80_REG_FLAGS] & M41T80_FLAGS_AF);
>> - return 0;
>> + return rtc_valid_tm(t);
>
> warning: passing argument 1 of ‘rtc_valid_tm’ from incompatible pointer type
>
> `t' is of type `struct rtc_wkalrm *', not `struct rtc_time *'.
> Probably the intention was:
>
> return rtc_valid_tm(&t->time);
Okay, thank you point this warning.
Andrew ,
Could you please fix this warning directly for me?
'return rtc_valid_tm(t)' should be insteaded by 'return
rtc_valid_tm(&t->time);'.
thanks!
>
> ??
>
>> }
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
>
--
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel@lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
* linux-arm-NUC900 mailing list
mail addr:NUC900@googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com@gmail.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rtc/m41t80: use rtc_valid_tm() to check returned tm
2010-08-13 1:43 ` Wan ZongShun
@ 2010-08-17 14:05 ` Atsushi Nemoto
2010-09-03 12:44 ` Atsushi Nemoto
0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2010-08-17 14:05 UTC (permalink / raw)
To: mcuos.com; +Cc: geert, akpm, a.zummo, linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=utf-8, Size: 2146 bytes --]
On Fri, 13 Aug 2010 09:43:38 +0800, Wan ZongShun <mcuos.com@gmail.com> wrote:
> 2010/8/13 Geert Uytterhoeven <geert@linux-m68k.org>:
> >> - Â Â Â return 0;
> >> + Â Â Â return rtc_valid_tm(t);
> >
> > warning: passing argument 1 of ârtc_valid_tmâ from incompatible pointer type
> >
> > `t' is of type `struct rtc_wkalrm *', not `struct rtc_time *'.
> > Probably the intention was:
> >
> > Â Â Â Â return rtc_valid_tm(&t->time);
>
> Okay, thank you point this warning.
>
> Andrew ,
>
> Could you please fix this warning directly for me?
> 'return rtc_valid_tm(t)' should be insteaded by 'return
> rtc_valid_tm(&t->time);'.
No, t->time does not contain complete date/time. It just holds some
alarm settings and -1 for some fields.
So rtc_valid_tm(&t->time) will always returns -EINVAL.
The correct fix would be just reverting rtc_valid_tm here.
------------------------------------------------------
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Subject: [PATCH] rtc: m41t80: do not use rtc_valid_tm in m41t80_rtc_read_alarm
The commit b485fe5ea ("rtc/m41t80: use rtc_valid_tm() to check
returned tm") added rtc_valid_tm to m41t80_rtc_read_alarm() but it was
wrong while the t->time does not contain complete date/time.
This patch also fix a warning:
warning: passing argument 1 of ârtc_valid_tmâ from incompatible pointer type
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
drivers/rtc/rtc-m41t80.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 66377f3..d60557c 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -364,7 +364,7 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t)
t->time.tm_isdst = -1;
t->enabled = !!(reg[M41T80_REG_ALARM_MON] & M41T80_ALMON_AFE);
t->pending = !!(reg[M41T80_REG_FLAGS] & M41T80_FLAGS_AF);
- return rtc_valid_tm(t);
+ return 0;
}
static struct rtc_class_ops m41t80_rtc_ops = {
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: rtc/m41t80: use rtc_valid_tm() to check returned tm
2010-08-17 14:05 ` Atsushi Nemoto
@ 2010-09-03 12:44 ` Atsushi Nemoto
0 siblings, 0 replies; 4+ messages in thread
From: Atsushi Nemoto @ 2010-09-03 12:44 UTC (permalink / raw)
To: mcuos.com; +Cc: geert, akpm, a.zummo, linux-kernel
On Tue, 17 Aug 2010 23:05:31 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> No, t->time does not contain complete date/time. It just holds some
> alarm settings and -1 for some fields.
>
> So rtc_valid_tm(&t->time) will always returns -EINVAL.
> The correct fix would be just reverting rtc_valid_tm here.
>
> ------------------------------------------------------
> From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> Subject: [PATCH] rtc: m41t80: do not use rtc_valid_tm in m41t80_rtc_read_alarm
Sorry, the patch contains non UTF-8 commit log.
I will resend the patch with corrected commit log.
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-09-03 12:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <201008111659.o7BGxn4g029524@hera.kernel.org>
2010-08-12 21:27 ` rtc/m41t80: use rtc_valid_tm() to check returned tm Geert Uytterhoeven
2010-08-13 1:43 ` Wan ZongShun
2010-08-17 14:05 ` Atsushi Nemoto
2010-09-03 12:44 ` Atsushi Nemoto
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.