[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <567E9059.30709@users.sourceforge.net>
Date: Sat, 26 Dec 2015 14:04:25 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-iio@...r.kernel.org, Hartmut Knaack <knaack.h@....de>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald <pmeerw@...erw.net>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH] iio: qcom-spmi-vadc: One check less in
vadc_measure_ref_points() after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 26 Dec 2015 13:53:15 +0100
This issue was detected by using the Coccinelle software.
Move the jump label directly before the desired log statement
so that the variable "ret" does not need to be checked once more
after it was determined that a function call failed.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/iio/adc/qcom-spmi-vadc.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index c2babe5..391eefa 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -424,7 +424,7 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc)
prop = vadc_get_channel(vadc, VADC_REF_1250MV);
ret = vadc_do_conversion(vadc, prop, &read_1);
if (ret)
- goto err;
+ goto report_failure;
/* Try with buffered 625mV channel first */
prop = vadc_get_channel(vadc, VADC_SPARE1);
@@ -433,11 +433,11 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc)
ret = vadc_do_conversion(vadc, prop, &read_2);
if (ret)
- goto err;
+ goto report_failure;
if (read_1 == read_2) {
ret = -EINVAL;
- goto err;
+ goto report_failure;
}
vadc->graph[VADC_CALIB_ABSOLUTE].dy = read_1 - read_2;
@@ -447,23 +447,24 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc)
prop = vadc_get_channel(vadc, VADC_VDD_VADC);
ret = vadc_do_conversion(vadc, prop, &read_1);
if (ret)
- goto err;
+ goto report_failure;
prop = vadc_get_channel(vadc, VADC_GND_REF);
ret = vadc_do_conversion(vadc, prop, &read_2);
if (ret)
- goto err;
+ goto report_failure;
if (read_1 == read_2) {
ret = -EINVAL;
- goto err;
+ goto report_failure;
}
vadc->graph[VADC_CALIB_RATIOMETRIC].dy = read_1 - read_2;
vadc->graph[VADC_CALIB_RATIOMETRIC].gnd = read_2;
-err:
- if (ret)
+ if (ret) {
+report_failure:
dev_err(vadc->dev, "measure reference points failed\n");
+ }
return ret;
}
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists