Re: 2.6.16-rc5-mm2

From: Benoit Boissinot
Date: Fri Mar 03 2006 - 12:06:56 EST


On 3/3/06, Andrew Morton <akpm@xxxxxxxx> wrote:
>
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16-rc5/2.6.16-rc5-mm2/
>
>
> - Should be a bit better than 2.6.16-rc5-mm1, but I still had to fix a ton
> of things to get this to compile and boot. We're not being careful enough.
>
> - The procfs rework is getting there, but some problems probably still remain.
>
> - There will be a number of new warnings at boot time when initcalls fail.
> Generally that's OK: it usually indicates that you linked something into
> vmlinux which you're not actually using. But sometimes it can indicate
> kernel bugs.
>
> - The (much-shrunk) audit git tree is back.
>

I have the following warning:

drivers/rtc/interface.c: In function 'rtc_set_mmss':
drivers/rtc/interface.c:91: warning: 'old.tm_hour' is used uninitialized in this function
drivers/rtc/interface.c:91: warning: 'old.tm_min' is used uninitialized in this function

The following patch fixes it (maybe using goto would be better and avoid
having lines > 80 chars).

Signed-off-by: Benoit Boissinot <benoit.boissinot@xxxxxxxxxxx>

Index: linux/drivers/rtc/interface.c
===================================================================
--- linux.orig/drivers/rtc/interface.c
+++ linux/drivers/rtc/interface.c
@@ -76,21 +76,25 @@ int rtc_set_mmss(struct class_device *cl
if (rtc->ops->read_time && rtc->ops->set_time) {
struct rtc_time new, old;

- new.tm_sec = secs % 60;
- secs /= 60;
- new.tm_min = secs % 60;
- secs /= 60;
- new.tm_hour = secs % 24;
-
- /*
- * avoid writing when we're going to change the day
- * of the month. We will retry in the next minute.
- * This basically means that if the RTC must not drift
- * by more than 1 minute in 11 minutes.
- */
- if (!((old.tm_hour == 23 && old.tm_min == 59) ||
- (new.tm_hour == 23 && new.tm_min == 59)))
- err = rtc->ops->set_time(class_dev->dev, &new);
+ err = rtc->ops->read_time(class_dev->dev, &old);
+ if (!err) {
+
+ new.tm_sec = secs % 60;
+ secs /= 60;
+ new.tm_min = secs % 60;
+ secs /= 60;
+ new.tm_hour = secs % 24;
+
+ /*
+ * avoid writing when we're going to change the day
+ * of the month. We will retry in the next minute.
+ * This basically means that if the RTC must not drift
+ * by more than 1 minute in 11 minutes.
+ */
+ if (!((old.tm_hour == 23 && old.tm_min == 59) ||
+ (new.tm_hour == 23 && new.tm_min == 59)))
+ err = rtc->ops->set_time(class_dev->dev, &new);
+ }
}
else
err = -EINVAL;
-
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/