Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp503018ybb; Wed, 1 Apr 2020 04:27:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv87SSAMPQ48L3kfw5J/rhrvTTSiHdu7u6JNLTBL1M2RVzmL0g5ukva1rwot49LnZ8r63wI X-Received: by 2002:a4a:2fd0:: with SMTP id p199mr6322399oop.14.1585740472956; Wed, 01 Apr 2020 04:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585740472; cv=none; d=google.com; s=arc-20160816; b=tfJ67b1bo9yE2937xAxaCll/Gog5gtb/hMgoCidwVMBw4XGimkm+zI/cZ2hyu2zqVc xP7AkFN5zFJvLqm7HN5eyPkPM769y7MipmVTablnO9POBu9DvBmdBFfAdsMkpZSBUoXh z6fHwCuwE1EggarizD0iD5DelEmZ5n2VQXofgh4iZrhOczQM5ie1ScaoXA6aXbXNCZMn zRSBKQNduDqVDLEYkhhlVutVEHOd/5LWNrW2ZA2ixQL93pMwl9/r4NJf6gI/q/CSHhXj f2kIizo8e3aGhPuOc87NFdKlUmQ1pPyRosBFQdgEzsM8KXisOfrK1j+B/xodm00Ams7t odNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=1nAbVjfCpSBTcxpTUsU/9ymzQqcsiRfYwmesgkrlhJU=; b=p5I807dvofeJHWSnoOXakO2PUTy/RxMymnXG6NZnw1YCchGcSDwjPrDGTT9aKF07jm APrIfvCiYnNCHPAwNfb7TL0jFNb2l2O2ZHwKazy/DqsLAS8cCcqL0Rf5+I3yfBK+9XCw B3LMDYcCk4t1Kqgomh6lIkQqt/qnUfR0O7BeSJusKd/ZYefjRFqUFiJQBf4ucL7NsvXS IWs5GftX00tlLfyq0kiMgXwx92ek9vJJrHH9wjcsnuMOK3cCYwLb06Xvl4tjZwn/iAKz pTnevhoL2kJ2g/bUnUXjKAj/6lgd4eEhC3z5a5Ey3gZha0KYC66yLeOj7wdp7ERRic16 jNaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si660775oth.209.2020.04.01.04.27.39; Wed, 01 Apr 2020 04:27:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732399AbgDALXb (ORCPT + 99 others); Wed, 1 Apr 2020 07:23:31 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:19414 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732121AbgDALXa (ORCPT ); Wed, 1 Apr 2020 07:23:30 -0400 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 031BMeUh010124; Wed, 1 Apr 2020 07:23:16 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com with ESMTP id 3023g5c3vb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Apr 2020 07:23:16 -0400 Received: from SCSQMBX10.ad.analog.com (scsqmbx10.ad.analog.com [10.77.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 031BNEGq043710 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Wed, 1 Apr 2020 07:23:15 -0400 Received: from SCSQMBX11.ad.analog.com (10.77.17.10) by SCSQMBX10.ad.analog.com (10.77.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Wed, 1 Apr 2020 04:23:13 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by SCSQMBX11.ad.analog.com (10.77.17.10) with Microsoft SMTP Server id 15.1.1779.2 via Frontend Transport; Wed, 1 Apr 2020 04:23:13 -0700 Received: from localhost.localdomain ([10.48.65.12]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 031BNAvr024109; Wed, 1 Apr 2020 07:23:10 -0400 From: Mircea Caprioru To: CC: , , , , , , Mircea Caprioru Subject: [PATCH] iio: core: Fix handling of 'dB' Date: Wed, 1 Apr 2020 14:22:30 +0300 Message-ID: <20200401112230.4708-1-mircea.caprioru@analog.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-ADIRoutedOnPrem: True X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-01_01:2020-03-31,2020-03-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1011 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 impostorscore=0 suspectscore=1 mlxlogscore=977 spamscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004010102 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes the call to iio_str_to_fixpoint when using 'dB' sufix. Before this the scale_db was not used when parsing the string written to the attribute and it failed with invalid value. Fixes: b8528224741b ("iio: core: Handle 'dB' suffix in core") Signed-off-by: Mircea Caprioru --- drivers/iio/industrialio-core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 157d95a24faa..7da9cd2a2b58 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -909,14 +909,11 @@ static ssize_t iio_write_channel_info(struct device *dev, return -EINVAL; integer = ch; } else { - ret = iio_str_to_fixpoint(buf, fract_mult, &integer, &fract); + ret = __iio_str_to_fixpoint(buf, fract_mult, &integer, &fract, + scale_db); if (ret) return ret; } - ret = __iio_str_to_fixpoint(buf, fract_mult, &integer, &fract, - scale_db); - if (ret) - return ret; ret = indio_dev->info->write_raw(indio_dev, this_attr->c, integer, fract, this_attr->address); -- 2.17.1