All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Antoni Pokusinski" <apokusinski01@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v6 6/9] rtc: abx80x: use regmap instead of I2C specific API
Date: Mon, 07 Sep 2026 20:47:15 +0000	[thread overview]
Message-ID: <20260907204716.152FA1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907203216.53192-7-apokusinski01@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] abx80x_read_alarm() unconditionally fails and returns -EIO because of a leftover partial-read check.
--

commit 927241f9edd452c16c2bc8ee202f13c63e681b56
Author: Antoni Pokusinski <apokusinski01@gmail.com>

rtc: abx80x: use regmap instead of I2C specific API

This commit refactors the abx80x RTC driver to use the regmap API
instead of the i2c_smbus_* functions. This abstraction prepares the
driver for future SPI support for ABX81X RTCs.

> diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
> --- a/drivers/rtc/rtc-abx80x.c
> +++ b/drivers/rtc/rtc-abx80x.c
> @@ -305,25 +308,24 @@ static irqreturn_t abx80x_handle_irq(int irq, void *dev_id)
>  
>  static int abx80x_read_alarm(struct device *dev, struct rtc_wkalrm *t)
>  {
> -	struct i2c_client *client = to_i2c_client(dev);
> -	struct abx80x_priv *priv = i2c_get_clientdata(client);
> +	struct abx80x_priv *priv = dev_get_drvdata(dev);
>  	unsigned char buf[7];
>  
> -	int irq_mask, err;
> +	unsigned int irq_mask;
> +	int err;
>  
>  	if (priv->irq <= 0)
>  		return -EINVAL;
>  
> -	err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ASC,
> -					    sizeof(buf), buf);
> -	if (err < 0)
> +	err = regmap_bulk_read(priv->regmap, ABX8XX_REG_ASC, buf, sizeof(buf));
> +	if (err)
>  		return err;
>  	if (err < ARRAY_SIZE(buf))
>  		return -EIO;

[Severity: High]
Does this inadvertently fail on all successful reads?

The legacy i2c_smbus_read_i2c_block_data() function returned the number of
bytes read, but regmap_bulk_read() returns 0 on success. Because
ARRAY_SIZE(buf) is 7, a successful regmap read where err == 0 will satisfy
the err < ARRAY_SIZE(buf) condition, causing abx80x_read_alarm() to always
return -EIO.

Should this partial-read check be removed entirely now that the driver uses
regmap_bulk_read()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260907203216.53192-1-apokusinski01@gmail.com?part=6

  reply	other threads:[~2026-09-07 20:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 20:32 [PATCH v6 0/9] rtc: abx80x: add support for abx81x Antoni Pokusinski
2026-09-07 20:32 ` [PATCH v6 1/9] dt-bindings: rtc: abx80x: document ABX81X RTCs Antoni Pokusinski
2026-09-07 20:41   ` sashiko-bot
2026-09-07 20:32 ` [PATCH v6 2/9] rtc: abx80x: fix error check after i2c_smbus_read in read_alarm() Antoni Pokusinski
2026-09-07 20:41   ` sashiko-bot
2026-09-07 20:32 ` [PATCH v6 3/9] rtc: abx80x: add mutex protection for register writes Antoni Pokusinski
2026-09-07 20:46   ` sashiko-bot
2026-09-09 18:01     ` Antoni Pokusinski
2026-09-07 20:32 ` [PATCH v6 4/9] rtc: abx80x: properly handle shared IRQs Antoni Pokusinski
2026-09-07 20:46   ` sashiko-bot
2026-09-07 20:32 ` [PATCH v6 5/9] rtc: abx80x: add irq to struct abx80x_priv Antoni Pokusinski
2026-09-07 20:49   ` sashiko-bot
2026-09-07 20:32 ` [PATCH v6 6/9] rtc: abx80x: use regmap instead of I2C specific API Antoni Pokusinski
2026-09-07 20:47   ` sashiko-bot [this message]
2026-09-07 20:32 ` [PATCH v6 7/9] rtc: abx80x: replace read-modify-write pattern with regmap helpers Antoni Pokusinski
2026-09-07 20:46   ` sashiko-bot
2026-09-09 18:03     ` Antoni Pokusinski
2026-09-07 20:32 ` [PATCH v6 8/9] rtc: abx80x: create abx80x_i2c_probe() Antoni Pokusinski
2026-09-07 20:41   ` sashiko-bot
2026-09-07 20:32 ` [PATCH v6 9/9] rtc: abx80x: add support for ABX81X Antoni Pokusinski
2026-09-07 20:52   ` sashiko-bot

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=20260907204716.152FA1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=apokusinski01@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.