Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751647AbbLZNEm (ORCPT ); Sat, 26 Dec 2015 08:04:42 -0500 Received: from mout.web.de ([212.227.17.11]:65019 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbbLZNEi (ORCPT ); Sat, 26 Dec 2015 08:04:38 -0500 Subject: [PATCH] iio: qcom-spmi-vadc: One check less in vadc_measure_ref_points() after error detection References: <566ABCD9.1060404@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall To: linux-iio@vger.kernel.org, Hartmut Knaack , Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald From: SF Markus Elfring Message-ID: <567E9059.30709@users.sourceforge.net> Date: Sat, 26 Dec 2015 14:04:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <566ABCD9.1060404@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:04pxCEe5vJ2UKzyUUm5j8wWf+qeQ8Z7TNaYR0mmRKfTuKc6nmpy L+B0dPZgx9hfVxrzqAS+P1uZWhvUmGIC2eJmv/cUXF2/5WqXrMck/Z6Pc9WZPsaWQsHkhtl xPYJuGazPC+TvPJD0/G20BMPa2pCcgH3DY5y3U8E8T/8HqwntpMZTk/HrHVOyIBuzlBcQSY +jQ3LcXW2M8Gh0ON9fu3A== X-UI-Out-Filterresults: notjunk:1;V01:K0:0HtF7JhF25o=:7E2/CYW2uO+VLGESN/NeIo 4lvteh+4fqvoIQzH7O4TkBuVKhEIBit4Zdx8ZF/scDjQVufzW7J8vxEPmqtdXytSQZ0WHki3i UksUXzD+7WsnnNyTbjtezMeAUGlAapV9sKztVV6kLykQ+zmjQvuXxnYQIFDgTBVp4+nw+Qgn4 33YdVv9+phgQy2MekjkwlG1+WdI+QqRSx7LdjmQeamb9w9pp4EpMabPhlRIuFO5fJwsH7q62P 8y3vLWa3pHXIVAosadrhEpOkrd+UMoIWuZm7T8rbDHV0K61BZ0apAQKah63ocJpWFN+h+pDPB zcNNa3F3iXJxxSJSefki4i1l3DIL0AQE644oamL6B1RD+N97WRVu7xBciO4G7wy9vO5yF+P/E axPrSAhX8cseNNHWRrM66BJpjZf3ciGYqnfTeH/WS0fOZA/1FTEmdEZH8VlAFVHdVKft5tz+l OwLN2HACHE636tqa3DF6G/+c+CuYR5Dc2oLPzT41CSBJSO00cQwEC4kAbQfys8grv3oLYqCmG y/4LuDIiZFkFpTYKXnRL1nRo9tenPn8S40Px4xefQtsN14PVYYyG3vga5ELnyWW+djXUaltH4 GqJTYdBJVOjNoQOwZbQ2RQvnC7ekQwLjm9S7JYxCWmNkTR2F58wOYme8yWSI5oNrtyZq63BgK F2RXJ6134qlwhFWKECZ96okkkOfu8GVOF+lFFLh9PH9mnCLDt/92Uo/EPN2RuP+W28z2YTr7L Gs+wA3zZV7XsYwsI3iCKod4mdb1nOgVqgl/x6zpgAJGPCII+NOJLD5lFGUJ18XUdUjoKxa+Ow jyQSf9x Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2299 Lines: 79 From: Markus Elfring 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 --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/