Devicetree
 help / color / mirror / Atom feed
From: Antoni Pokusinski <apokusinski01@gmail.com>
To: alexandre.belloni@bootlin.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org
Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Antoni Pokusinski <apokusinski01@gmail.com>
Subject: [PATCH v4 2/9] rtc: abx80x: fix error check after i2c_smbus_read in read_alarm()
Date: Mon, 10 Aug 2026 21:38:19 +0200	[thread overview]
Message-ID: <20260810193826.210683-3-apokusinski01@gmail.com> (raw)
In-Reply-To: <20260810193826.210683-1-apokusinski01@gmail.com>

i2c_smbus_read_i2c_block_data() returns the number of bytes read on
success and a negative error code on failure. The existing code treated
any non-zero return value as an error.

Fix the error handling by checking only for negative return values.

Fixes: 718a820a303c ("rtc: abx80x: add alarm support")
Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
---
 drivers/rtc/rtc-abx80x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 5486d9d0b1e5..fdf9664ebb6f 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -294,7 +294,7 @@ static int abx80x_read_alarm(struct device *dev, struct rtc_wkalrm *t)
 
 	err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ASC,
 					    sizeof(buf), buf);
-	if (err)
+	if (err < 0)
 		return err;
 
 	irq_mask = i2c_smbus_read_byte_data(client, ABX8XX_REG_IRQ);
-- 
2.55.0


  parent reply	other threads:[~2026-08-10 19:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 19:38 [PATCH v4 0/9] rtc: abx80x: add support for abx81x Antoni Pokusinski
2026-08-10 19:38 ` [PATCH v4 1/9] dt-bindings: rtc: abx80x: document ABX81X RTCs Antoni Pokusinski
2026-08-10 19:38 ` Antoni Pokusinski [this message]
2026-08-10 19:38 ` [PATCH v4 3/9] rtc: abx80x: add mutex protection for register writes Antoni Pokusinski
2026-08-10 19:38 ` [PATCH v4 4/9] rtc: abx80x: properly handle shared IRQs Antoni Pokusinski
2026-08-10 19:38 ` [PATCH v4 5/9] rtc: abx80x: add irq to struct abx80x_priv Antoni Pokusinski
2026-08-10 19:38 ` [PATCH v4 6/9] rtc: abx80x: use regmap instead of I2C specific API Antoni Pokusinski
2026-08-10 19:38 ` [PATCH v4 7/9] rtc: abx80x: replace read-modify-write pattern with regmap helpers Antoni Pokusinski
2026-08-10 19:38 ` [PATCH v4 8/9] rtc: abx80x: create abx80x_i2c_probe() Antoni Pokusinski
2026-08-10 19:38 ` [PATCH v4 9/9] rtc: abx80x: add support for ABX81X Antoni Pokusinski

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=20260810193826.210683-3-apokusinski01@gmail.com \
    --to=apokusinski01@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox