Re: rtc/m41t80: use rtc_valid_tm() to check returned tm

From: Geert Uytterhoeven
Date: Thu Aug 12 2010 - 17:27:38 EST


On Wed, Aug 11, 2010 at 18:59, Linux Kernel Mailing List
<linux-kernel@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/