From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21F36C7EE23 for ; Wed, 7 Jun 2023 20:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233591AbjFGU3k (ORCPT ); Wed, 7 Jun 2023 16:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233583AbjFGU3h (ORCPT ); Wed, 7 Jun 2023 16:29:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F4671706 for ; Wed, 7 Jun 2023 13:29:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5059D6448C for ; Wed, 7 Jun 2023 20:29:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62946C4339B; Wed, 7 Jun 2023 20:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686169760; bh=0pcqTTqlR3Qj/f34cBU6JnVRvGQ3xgIzQ3rAh732/FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rpHQWYPOuUhUVchjPI1MwJ4gMVyC9TrViA3Qk8qw9H8SfLQFe+9K54QaUisDNMj8E Tv8j98DX8ZB1qHd+nQuWtzTG0CGrAmmdFa1MUfNEaPuNZKDfmZlOQL5/OW0AGLiunU 6mFJT23irxPhvBmYESmwaGmMWsKeNCaq8sOaRzI4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rasmus Villemoes , Nuno Sa , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 6.3 204/286] iio: addac: ad74413: fix resistance input processing Date: Wed, 7 Jun 2023 22:15:03 +0200 Message-ID: <20230607200929.920400068@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607200922.978677727@linuxfoundation.org> References: <20230607200922.978677727@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rasmus Villemoes commit 24febc99ca725dcf42d57168a2f4e8a75a5ade92 upstream. On success, ad74413r_get_single_adc_result() returns IIO_VAL_INT aka 1. So currently, the IIO_CHAN_INFO_PROCESSED case is effectively equivalent to the IIO_CHAN_INFO_RAW case, and we never call ad74413r_adc_to_resistance_result() to convert the adc measurement to ohms. Check ret for being negative rather than non-zero. Fixes: fea251b6a5dbd (iio: addac: add AD74413R driver) Signed-off-by: Rasmus Villemoes Reviewed-by: Nuno Sa Link: https://lore.kernel.org/r/20230503095817.452551-1-linux@rasmusvillemoes.dk Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/addac/ad74413r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -981,7 +981,7 @@ static int ad74413r_read_raw(struct iio_ ret = ad74413r_get_single_adc_result(indio_dev, chan->channel, val); - if (ret) + if (ret < 0) return ret; ad74413r_adc_to_resistance_result(*val, val);