All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: u.kleine-koenig@pengutronix.de
Cc: linux-rtc@vger.kernel.org
Subject: [bug report] rtc: ds1307: rx8130: honor Voltage Loss Flag when reading the time
Date: Wed, 13 Feb 2019 16:17:31 +0300	[thread overview]
Message-ID: <20190213131731.GA29774@kadam> (raw)

Hello Uwe Kleine-König,

The patch 501f98266cad: "rtc: ds1307: rx8130: honor Voltage Loss Flag
when reading the time" from Jan 25, 2019, leads to the following
static checker warning:

	drivers/rtc/rtc-ds1307.c:314 ds1307_set_time()
	warn: this cast is a no-op

drivers/rtc/rtc-ds1307.c
    304 	result = regmap_bulk_write(ds1307->regmap, chip->offset, regs,
    305 				   sizeof(regs));
    306 	if (result) {
    307 		dev_err(dev, "%s error %d\n", "write", result);
    308 		return result;
    309 	}
    310 
    311 	if (ds1307->type == rx_8130) {
    312 		/* clear Voltage Loss Flag as data is available now */
    313 		result = regmap_write(ds1307->regmap, RX8130_REG_FLAG,
--> 314 				      ~(u8)RX8130_REG_FLAG_VLF);
                                               ^^^^^^^^^^^^^^^^^^^^^^^^
RX8130_REG_FLAG_VLF is 0x2.  The cast to u8 doesn't change anything
because it gets type promoted to int.  I don't know what was intended.

    315 		if (result) {
    316 			dev_err(dev, "%s error %d\n", "write", result);
    317 			return result;
    318 		}
    319 	}
    320 
    321 	return 0;
    322 }

regards,
dan carpenter

             reply	other threads:[~2019-02-13 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 13:17 Dan Carpenter [this message]
2019-02-13 17:51 ` [bug report] rtc: ds1307: rx8130: honor Voltage Loss Flag when reading the time Uwe Kleine-König
2019-02-13 19:43   ` Dan Carpenter

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=20190213131731.GA29774@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.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.