In rv3028_probe(), the return value of devm_regmap_init_i2c() should
be checked before it is used.
Signed-off-by: Xidong Wang <[email protected]>
---
drivers/rtc/rtc-rv3028.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
index 06884eb..29a8c4e 100644
--- a/drivers/rtc/rtc-rv3028.c
+++ b/drivers/rtc/rtc-rv3028.c
@@ -626,6 +626,10 @@ static int rv3028_probe(struct i2c_client *client)
rv3028->regmap = devm_regmap_init_i2c(client, ®map_config);
+ if (IS_ERR(rv3028->regmap)) {
+ return PTR_ERR(rv3028->regmap);
+ }
+
i2c_set_clientdata(client, rv3028);
ret = regmap_read(rv3028->regmap, RV3028_STATUS, &status);
--
2.7.4
Hello,
On 29/05/2019 15:22:20+0800, Xidong Wang wrote:
> In rv3028_probe(), the return value of devm_regmap_init_i2c() should
> be checked before it is used.
>
> Signed-off-by: Xidong Wang <[email protected]>
> ---
> drivers/rtc/rtc-rv3028.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
> index 06884eb..29a8c4e 100644
> --- a/drivers/rtc/rtc-rv3028.c
> +++ b/drivers/rtc/rtc-rv3028.c
> @@ -626,6 +626,10 @@ static int rv3028_probe(struct i2c_client *client)
>
> rv3028->regmap = devm_regmap_init_i2c(client, ®map_config);
>
Remove that empty line.
> + if (IS_ERR(rv3028->regmap)) {
> + return PTR_ERR(rv3028->regmap);
> + }
Unnecessary braces.
> +
> i2c_set_clientdata(client, rv3028);
>
> ret = regmap_read(rv3028->regmap, RV3028_STATUS, &status);
> --
> 2.7.4
>
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com