All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "rtc: s35390a: make sure all members in the output are set" has been added to the 3.18-stable tree
@ 2017-04-18 18:34 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-04-18 18:34 UTC (permalink / raw)
  To: uwe, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    rtc: s35390a: make sure all members in the output are set

to the 3.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rtc-s35390a-make-sure-all-members-in-the-output-are-set.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From fdd4bc9313e59a1757cfc8ac5836cff55ec03eeb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <uwe@kleine-koenig.org>
Date: Mon, 3 Apr 2017 23:32:38 +0200
Subject: rtc: s35390a: make sure all members in the output are set
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Uwe Kleine-König <uwe@kleine-koenig.org>

commit fdd4bc9313e59a1757cfc8ac5836cff55ec03eeb in 4.4-stable.

The rtc core calls the .read_alarm with all fields initialized to 0. As
the s35390a driver doesn't touch some fields the returned date is
interpreted as a date in January 1900. So make sure all fields are set
to -1; some of them are then overwritten with the right data depending
on the hardware state.

In mainline this is done by commit d68778b80dd7 ("rtc: initialize output
parameter for read alarm to "uninitialized"") in the core. This is
considered to dangerous for stable as it might have side effects for
other rtc drivers that might for example rely on alarm->time.tm_sec
being initialized to 0.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/rtc/rtc-s35390a.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -267,6 +267,20 @@ static int s35390a_read_alarm(struct i2c
 	char buf[3], sts;
 	int i, err;
 
+	/*
+	 * initialize all members to -1 to signal the core that they are not
+	 * defined by the hardware.
+	 */
+	alm->time.tm_sec = -1;
+	alm->time.tm_min = -1;
+	alm->time.tm_hour = -1;
+	alm->time.tm_mday = -1;
+	alm->time.tm_mon = -1;
+	alm->time.tm_year = -1;
+	alm->time.tm_wday = -1;
+	alm->time.tm_yday = -1;
+	alm->time.tm_isdst = -1;
+
 	err = s35390a_get_reg(s35390a, S35390A_CMD_STATUS2, &sts, sizeof(sts));
 	if (err < 0)
 		return err;


Patches currently in stable-queue which might be from uwe@kleine-koenig.org are

queue-3.18/rtc-s35390a-improve-irq-handling.patch
queue-3.18/rtc-s35390a-fix-reading-out-alarm.patch
queue-3.18/rtc-s35390a-make-sure-all-members-in-the-output-are-set.patch
queue-3.18/rtc-s35390a-implement-reset-routine-as-suggested-by-the-reference.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-18 18:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18 18:34 Patch "rtc: s35390a: make sure all members in the output are set" has been added to the 3.18-stable tree gregkh

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.