From patchwork Thu Jan 30 13:42:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11358111 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E770921 for ; Thu, 30 Jan 2020 13:42:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45EAC2083E for ; Thu, 30 Jan 2020 13:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727368AbgA3Nmn (ORCPT ); Thu, 30 Jan 2020 08:42:43 -0500 Received: from honk.sigxcpu.org ([24.134.29.49]:53262 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726980AbgA3Nmm (ORCPT ); Thu, 30 Jan 2020 08:42:42 -0500 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id B5E6DFB02; Thu, 30 Jan 2020 14:42:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NLp-z8NNH201; Thu, 30 Jan 2020 14:42:37 +0100 (CET) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id CD7524091D; Thu, 30 Jan 2020 14:42:36 +0100 (CET) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Tomas Novotny , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , "Angus Ainslie (Purism)" , =?utf-8?q?Guido_G=C3=BCnther?= , Marco Felsch , Thomas Gleixner , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] iio: vcnl4000: Use a single return when getting IIO_CHAN_INFO_RAW Date: Thu, 30 Jan 2020 14:42:35 +0100 Message-Id: <86e272aaf6726d6d5171445e7f2df6cdbb74057f.1580391472.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org This will be useful when introducing runtime pm. Signed-off-by: Guido Günther --- drivers/iio/light/vcnl4000.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index b0e241aaefb4..8f198383626b 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -335,17 +335,18 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev, switch (chan->type) { case IIO_LIGHT: ret = data->chip_spec->measure_light(data, val); - if (ret < 0) - return ret; - return IIO_VAL_INT; + if (!ret) + ret = IIO_VAL_INT; + break; case IIO_PROXIMITY: ret = data->chip_spec->measure_proximity(data, val); - if (ret < 0) - return ret; - return IIO_VAL_INT; + if (!ret) + ret = IIO_VAL_INT; + break; default: - return -EINVAL; + ret = -EINVAL; } + return ret; case IIO_CHAN_INFO_SCALE: if (chan->type != IIO_LIGHT) return -EINVAL;