Commit ce0fd9db authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: ds1343: check regmap_read return value

Check whether regmap_read fails before continuing in the sysfs .show
callbacks.

Link: https://lore.kernel.org/r/20191019204941.6203-6-alexandre.belloni@bootlin.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent ac08888b
...@@ -92,8 +92,11 @@ static ssize_t ds1343_show_glitchfilter(struct device *dev, ...@@ -92,8 +92,11 @@ static ssize_t ds1343_show_glitchfilter(struct device *dev,
{ {
struct ds1343_priv *priv = dev_get_drvdata(dev->parent); struct ds1343_priv *priv = dev_get_drvdata(dev->parent);
int glitch_filt_status, data; int glitch_filt_status, data;
int res;
regmap_read(priv->map, DS1343_CONTROL_REG, &data); res = regmap_read(priv->map, DS1343_CONTROL_REG, &data);
if (res)
return res;
glitch_filt_status = !!(data & DS1343_EGFIL); glitch_filt_status = !!(data & DS1343_EGFIL);
...@@ -147,10 +150,12 @@ static ssize_t ds1343_show_tricklecharger(struct device *dev, ...@@ -147,10 +150,12 @@ static ssize_t ds1343_show_tricklecharger(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ds1343_priv *priv = dev_get_drvdata(dev->parent); struct ds1343_priv *priv = dev_get_drvdata(dev->parent);
int data; int res, data;
char *diodes = "disabled", *resistors = " "; char *diodes = "disabled", *resistors = " ";
regmap_read(priv->map, DS1343_TRICKLE_REG, &data); res = regmap_read(priv->map, DS1343_TRICKLE_REG, &data);
if (res)
return res;
if ((data & 0xf0) == DS1343_TRICKLE_MAGIC) { if ((data & 0xf0) == DS1343_TRICKLE_MAGIC) {
switch (data & 0x0c) { switch (data & 0x0c) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment