* [PATCH 1/1] rtc: rv3028: check return value
@ 2019-05-29 7:22 Xidong Wang
2019-06-01 21:03 ` Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Xidong Wang @ 2019-05-29 7:22 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni; +Cc: Xidong Wang, linux-rtc, linux-kernel
In rv3028_probe(), the return value of devm_regmap_init_i2c() should
be checked before it is used.
Signed-off-by: Xidong Wang <wangxidong_97@163.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] rtc: rv3028: check return value
2019-05-29 7:22 [PATCH 1/1] rtc: rv3028: check return value Xidong Wang
@ 2019-06-01 21:03 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2019-06-01 21:03 UTC (permalink / raw)
To: Xidong Wang; +Cc: Alessandro Zummo, linux-rtc, linux-kernel
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 <wangxidong_97@163.com>
> ---
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-01 21:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 7:22 [PATCH 1/1] rtc: rv3028: check return value Xidong Wang
2019-06-01 21:03 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).