* rtc-pcf85063 driver bug in pcf85063_stop_clock()
@ 2018-10-11 6:53 Craig McQueen
2018-10-15 12:39 ` Alexandre Belloni
2018-11-19 22:56 ` Craig McQueen
0 siblings, 2 replies; 5+ messages in thread
From: Craig McQueen @ 2018-10-11 6:53 UTC (permalink / raw)
To: linux-rtc
The function pcf85063_stop_clock() is intended to provide the value of the Control_1 register via the pointer ctrl1.
However, it's really providing the return value of the last i2c_smbus_write_byte_data() call, i.e., zero. So the register value needs to be saved in a separate local variable other than ret. Or, the line *ctrl1 = ret; needs to be moved up to be above the last i2c_smbus_write_byte_data() call.
--
Craig McQueen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: rtc-pcf85063 driver bug in pcf85063_stop_clock()
2018-10-11 6:53 rtc-pcf85063 driver bug in pcf85063_stop_clock() Craig McQueen
@ 2018-10-15 12:39 ` Alexandre Belloni
2018-11-19 22:56 ` Craig McQueen
1 sibling, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2018-10-15 12:39 UTC (permalink / raw)
To: Craig McQueen; +Cc: linux-rtc
Hello,
On 11/10/2018 06:53:15+0000, Craig McQueen wrote:
> The function pcf85063_stop_clock() is intended to provide the value of the Control_1 register via the pointer ctrl1.
>
> However, it's really providing the return value of the last i2c_smbus_write_byte_data() call, i.e., zero. So the register value needs to be saved in a separate local variable other than ret. Or, the line *ctrl1 = ret; needs to be moved up to be above the last i2c_smbus_write_byte_data() call.
>
Isn't that fixed by http://patchwork.ozlabs.org/patch/944107/ ?
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: rtc-pcf85063 driver bug in pcf85063_stop_clock()
2018-10-11 6:53 rtc-pcf85063 driver bug in pcf85063_stop_clock() Craig McQueen
2018-10-15 12:39 ` Alexandre Belloni
@ 2018-11-19 22:56 ` Craig McQueen
2018-11-25 14:10 ` Alexandre Belloni
1 sibling, 1 reply; 5+ messages in thread
From: Craig McQueen @ 2018-11-19 22:56 UTC (permalink / raw)
To: linux-rtc
I wrote:
>
> The function pcf85063_stop_clock() is intended to provide the value of the
> Control_1 register via the pointer ctrl1.
>
> However, it's really providing the return value of the last
> i2c_smbus_write_byte_data() call, i.e., zero. So the register value needs to
> be saved in a separate local variable other than ret. Or, the line *ctrl1 = ret;
> needs to be moved up to be above the last i2c_smbus_write_byte_data()
> call.
I'd like to follow up on this. I could perhaps submit a patch, but I'm not sure what is the best fix for this bug. Any recommendations?
--
Craig McQueen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: rtc-pcf85063 driver bug in pcf85063_stop_clock()
2018-11-19 22:56 ` Craig McQueen
@ 2018-11-25 14:10 ` Alexandre Belloni
2018-11-26 0:21 ` Craig McQueen
0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2018-11-25 14:10 UTC (permalink / raw)
To: Craig McQueen; +Cc: linux-rtc
Hello,
On 19/11/2018 22:56:07+0000, Craig McQueen wrote:
> I wrote:
> >
> > The function pcf85063_stop_clock() is intended to provide the value of the
> > Control_1 register via the pointer ctrl1.
> >
> > However, it's really providing the return value of the last
> > i2c_smbus_write_byte_data() call, i.e., zero. So the register value needs to
> > be saved in a separate local variable other than ret. Or, the line *ctrl1 = ret;
> > needs to be moved up to be above the last i2c_smbus_write_byte_data()
> > call.
>
> I'd like to follow up on this. I could perhaps submit a patch, but I'm not sure what is the best fix for this bug. Any recommendations?
>
I replied a while ago, isn't that fixed by:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/rtc/rtc-pcf85063.c?id=ec9cf1b7a6af2c0cffaa887351e7c7acced5290e
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: rtc-pcf85063 driver bug in pcf85063_stop_clock()
2018-11-25 14:10 ` Alexandre Belloni
@ 2018-11-26 0:21 ` Craig McQueen
0 siblings, 0 replies; 5+ messages in thread
From: Craig McQueen @ 2018-11-26 0:21 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc
Alexandre Belloni wrote:
>
> Hello,
>
> On 19/11/2018 22:56:07+0000, Craig McQueen wrote:
> > I wrote:
> > >
> > > The function pcf85063_stop_clock() is intended to provide the value
> > > of the
> > > Control_1 register via the pointer ctrl1.
> > >
> > > However, it's really providing the return value of the last
> > > i2c_smbus_write_byte_data() call, i.e., zero. So the register value
> > > needs to be saved in a separate local variable other than ret. Or,
> > > the line *ctrl1 = ret; needs to be moved up to be above the last
> > > i2c_smbus_write_byte_data() call.
> >
> > I'd like to follow up on this. I could perhaps submit a patch, but I'm not sure
> what is the best fix for this bug. Any recommendations?
> >
>
> I replied a while ago, isn't that fixed by:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/d
> rivers/rtc/rtc-pcf85063.c?id=ec9cf1b7a6af2c0cffaa887351e7c7acced5290e
Thanks, that looks like a fix for the exact problem. I thought I'd checked the master branch for a fix before posting this, but maybe I hadn't fetched the latest that includes that commit.
Sorry I missed your previous reply.
--
Craig McQueen
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-26 0:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-11 6:53 rtc-pcf85063 driver bug in pcf85063_stop_clock() Craig McQueen
2018-10-15 12:39 ` Alexandre Belloni
2018-11-19 22:56 ` Craig McQueen
2018-11-25 14:10 ` Alexandre Belloni
2018-11-26 0:21 ` Craig McQueen
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.