From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH] iio: qcom-spmi-vadc: One check less in vadc_measure_ref_points() after error detection
Date: Sat, 26 Dec 2015 14:04:25 +0100 [thread overview]
Message-ID: <567E9059.30709@users.sourceforge.net> (raw)
In-Reply-To: <566ABCD9.1060404@users.sourceforge.net>
From: Markus Elfring <elfring@users.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@users.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
next parent reply other threads:[~2015-12-26 13:04 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <566ABCD9.1060404@users.sourceforge.net>
2015-12-26 13:04 ` SF Markus Elfring [this message]
2016-01-02 18:28 ` [PATCH] iio: qcom-spmi-vadc: One check less in vadc_measure_ref_points() after error detection Jonathan Cameron
2016-09-24 6:22 ` [PATCH 0/7] iio: Fine-tuning for several function implementations SF Markus Elfring
2016-09-24 6:24 ` [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set() SF Markus Elfring
2016-09-24 15:36 ` Jonathan Cameron
2016-09-24 16:18 ` SF Markus Elfring
2016-09-24 16:36 ` Jonathan Cameron
2016-09-24 6:25 ` [PATCH 2/7] iio: Rename a jump label in iio_buffer_store_watermark() SF Markus Elfring
2016-09-24 15:32 ` Jonathan Cameron
2016-09-24 19:21 ` SF Markus Elfring
2016-09-25 8:45 ` Jonathan Cameron
2016-09-25 13:00 ` SF Markus Elfring
2016-09-25 14:23 ` Jonathan Cameron
2016-09-25 15:17 ` SF Markus Elfring
2016-09-25 16:49 ` Jonathan Cameron
2016-09-25 17:31 ` SF Markus Elfring
2016-09-24 6:26 ` [PATCH 3/7] iio: Rename a jump label in iio_buffer_store_enable() SF Markus Elfring
2016-09-24 6:28 ` [PATCH 4/7] iio: Rename a jump label in iio_buffer_write_length() SF Markus Elfring
2016-09-24 6:29 ` [PATCH 5/7] iio: Rename a jump label in iio_scan_el_ts_store() SF Markus Elfring
2016-09-24 6:30 ` [PATCH 6/7] iio: Rename a jump label in iio_scan_el_store() SF Markus Elfring
2016-09-24 6:31 ` [PATCH 7/7] iio: Adjust checks for null pointers in six functions SF Markus Elfring
2016-09-25 14:24 ` Jonathan Cameron
2016-09-25 14:44 ` SF Markus Elfring
2016-09-25 16:51 ` Jonathan Cameron
2016-09-25 17:45 ` SF Markus Elfring
2016-09-25 18:15 ` Al Viro
2016-09-25 19:30 ` SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=567E9059.30709@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=jic23@kernel.org \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).