Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Pointer target signedness mismatch due to passing `int *` to `regmap_read()`.
--
--- Patch [6]: [PATCH v4 6/9] rtc: abx80x: use regmap instead of I2C specific API ---
commit 2c13ab934066f6ede54c1bee1c9c8966213b138d
Author: Antoni Pokusinski <[email protected]>
Subject: rtc: abx80x: use regmap instead of I2C specific API
This commit converts the ABX80x RTC driver to use regmap instead of i2c_smbus
functions. This enables future support for ABX81X SPI-based variants.
> diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
> index 12a4dbfec6396..5d41882f3c704 100644
> --- a/drivers/rtc/rtc-abx80x.c
> +++ b/drivers/rtc/rtc-abx80x.c
[ ... ]
> @@ -227,8 +230,7 @@ static int abx80x_rtc_read_time(struct device *dev, struct rtc_time *tm)
>
> static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
> {
> - 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[8];
> int err, flags;
[ ... ]
> @@ -246,22 +248,22 @@ static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
>
> guard(mutex)(&priv->lock);
>
[ ... ]
>
> /* Clear the OF bit of Oscillator Status Register */
> - flags = i2c_smbus_read_byte_data(client, ABX8XX_REG_OSS);
> - if (flags < 0)
> - return flags;
> + err = regmap_read(priv->regmap, ABX8XX_REG_OSS, &flags);
[Severity: Low]
This isn't a bug, but could passing a pointer to the signed int flags into
regmap_read() trigger a pointer target signedness mismatch warning?
Since regmap_read() expects an unsigned int pointer for its value parameter,
would it be better to change the declaration of flags in abx80x_rtc_set_time()
to unsigned int to avoid cluttering the build output?
> + if (err < 0)
> + return err;
>
> - err = i2c_smbus_write_byte_data(client, ABX8XX_REG_OSS,
> - flags & ~ABX8XX_OSS_OF);
> + err = regmap_write(priv->regmap, ABX8XX_REG_OSS,
> + flags & ~ABX8XX_OSS_OF);
> if (err < 0) {
> - dev_err(&client->dev, "Unable to write oscillator status register\n");
> + dev_err(dev, "Unable to write oscillator status register\n");
> return err;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.