All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: u-boot@lists.denx.de, michael@walle.cc
Cc: hs@denx.de, philipp.tomsich@theobroma-systems.com,
	sjg@chromium.org, oliver.graute@kococonnector.com
Subject: Re: possible off-by-one error on month counting in rtc rv8803 driver
Date: Mon, 25 Apr 2022 15:50:02 +0200	[thread overview]
Message-ID: <cc7f6f1cd19bab8bb5f21bff814c2f69@walle.cc> (raw)
In-Reply-To: <20220425125539.GA16510@optiplex>

Hi,

Am 2022-04-25 14:55, schrieb Oliver Graute:
> I stumbled across the following possible off-by-one error in counting 
> the
> month in RTC driver rv8803.
..

> (drivers/rtc/rv8803.c)
> rv8803_rtc_set()
> ...
> buf[RTC_MON_REG_ADDR] = bin2bcd(tm->tm_mon)
> ...
> 
> rv8803_rtc_get()
> ...
> tm->tm_mon  = bcd2bin(buf[RTC_MON_REG_ADDR] & 0x1F);
> ...
> 
> I assume that the error is here and increase and decrease by one is 
> also
> required here like in the Linux driver code for RTC 8803.

Indeed. tm_mon has a range from 0 .. 11, but the RTC expects 1..12.
Nice catch.

> Can someone verify and comment on this. Then I would prepare a patch
> later on.

Yes please.

-michael

      reply	other threads:[~2022-04-25 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 12:55 possible off-by-one error on month counting in rtc rv8803 driver Oliver Graute
2022-04-25 13:50 ` Michael Walle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc7f6f1cd19bab8bb5f21bff814c2f69@walle.cc \
    --to=michael@walle.cc \
    --cc=hs@denx.de \
    --cc=oliver.graute@kococonnector.com \
    --cc=philipp.tomsich@theobroma-systems.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.