From patchwork Sun Dec 24 14:34:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 183060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp2161180dyi; Sun, 24 Dec 2023 06:36:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGS6fUWK5dHCBgiyGkaX8KU0Jmv+XonaN6/v4MJ1FUHU5Op24PDXVSJIFsfebumQ8uNfRiA X-Received: by 2002:a17:90a:5148:b0:28c:120:2dfd with SMTP id k8-20020a17090a514800b0028c01202dfdmr2553159pjm.69.1703428604324; Sun, 24 Dec 2023 06:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703428604; cv=none; d=google.com; s=arc-20160816; b=o4/AIxzSRAygcOIKq1INDQD27gDIbDsACb8jl8l0DmVtj3rtkeZUS4jrGdFu5cBMQi PMo3t+UlAg8RXR+nPrqocrLDtVhZOzMizKvUbexN9+2DjF+DkpYENoSDI7J9ycUoSN5U tFIi0vVtAtpzq6+6+pFnPFvdAwXK8peqS35WqTujomihSA18tP+PLjguGVIgceYvZSiS WwUR+YTCTUyifpV1LEfjy92IeTSUfuBlkwn5qduLxOhi5kmDjRqBXMQ7UEmLUb6HAogF YcLdI5DUu6wwmypclmZycSEW2fMmsNvJckcNCuoeUGQz+0VI3qYuiWaHQF3mk6jKkX3G 5K/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=aGd8OCxVSGDYHMl4aMCuED8TchwzIDqQ0WsMBC/SPLY=; fh=cuSrpdmFbNnIGKLvcD6905UtzyKVEbJe+tTFY3eiseU=; b=Xr4ekg3cGui6txmQ2Mxhg7vh3LUlD1hkTp2yi3JkIDCwYHx4t9I7y7sBy45cv2TTK3 oEqBkBRmHeaRKeR4kyp3tW0AG4CIa2cRZ5YHfv+e+7pnokDNfFXCWSj2eU2nZzJNnFYO qAgVfHySNMOBULsT+eq5wDVX833kmflOJDhZTEMTx4lvL7ORxhny9BlcgpFQk722D8+r x63mFKAFbl4SA1BVZE0zWin85b49Gfo2eDQKsqNfV+Tn7v7EQfKFqIuXJtNWIpEN3Br2 73AapdR/6K0PaN228AUNDoqAhipzi1iwbUQkfkegiRXzYOAGYTOhRlb0R5keUrN93+k1 oAUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=S7n3rG5V; spf=pass (google.com: domain of linux-kernel+bounces-10724-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10724-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n10-20020a17090a9f0a00b0028beed57779si6221221pjp.123.2023.12.24.06.36.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 06:36:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10724-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=S7n3rG5V; spf=pass (google.com: domain of linux-kernel+bounces-10724-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10724-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1BAFA282063 for ; Sun, 24 Dec 2023 14:36:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 749CE101C4; Sun, 24 Dec 2023 14:35:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="S7n3rG5V" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.subdimension.ro (skycaves.subdimension.ro [172.104.132.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D6125677; Sun, 24 Dec 2023 14:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=subdimension.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=subdimension.ro Received: from localhost.localdomain (unknown [188.24.94.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.subdimension.ro (Postfix) with ESMTPSA id 2833528B586; Sun, 24 Dec 2023 14:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1703428511; bh=VhoWuBoCBEakCVIBAnazDcOgZVIKUnaIyUzxFGulZjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=S7n3rG5V2AITRn+noHfqNeZVANnQwFLsqD/jCmUXTK/8sPdKhbHtLcH/L3swrGRMp 9L+XiVcqEqQHU7mfGwxjYHRarYX4wldGFPv5q2lHHJFPjC8kmpVM7r+eMwaervbmue ltlzz1lfDYnBQsvpobI/+z/JZuB/Y173k3nZSJGE= From: Petre Rodan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Andreas Klinger , Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Angel Iglesias , Matti Vaittinen Subject: [PATCH v2 04/10] iio: pressure: mprls0025pa.c fix off-by-one enum Date: Sun, 24 Dec 2023 16:34:49 +0200 Message-ID: <20231224143500.10940-5-petre.rodan@subdimension.ro> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231224143500.10940-1-petre.rodan@subdimension.ro> References: <20231224143500.10940-1-petre.rodan@subdimension.ro> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786174352288857499 X-GMAIL-MSGID: 1786174352288857499 Fix off-by-one error in transfer-function property. The honeywell,transfer-function property takes values between 1-3 so make sure the proper enum gets used. Signed-off-by: Petre Rodan Signed-off-by: Andreas Klinger --- drivers/iio/pressure/mprls0025pa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.41.0 diff --git a/drivers/iio/pressure/mprls0025pa.c b/drivers/iio/pressure/mprls0025pa.c index 30fb2de36821..e3f0de020a40 100644 --- a/drivers/iio/pressure/mprls0025pa.c +++ b/drivers/iio/pressure/mprls0025pa.c @@ -323,6 +323,7 @@ static int mpr_probe(struct i2c_client *client) struct iio_dev *indio_dev; struct device *dev = &client->dev; s64 scale, offset; + u32 func; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) return dev_err_probe(dev, -EOPNOTSUPP, @@ -362,10 +363,11 @@ static int mpr_probe(struct i2c_client *client) return dev_err_probe(dev, ret, "honeywell,pmax-pascal could not be read\n"); ret = device_property_read_u32(dev, - "honeywell,transfer-function", &data->function); + "honeywell,transfer-function", &func); if (ret) return dev_err_probe(dev, ret, "honeywell,transfer-function could not be read\n"); + data->function = func - 1; if (data->function > MPR_FUNCTION_C) return dev_err_probe(dev, -EINVAL, "honeywell,transfer-function %d invalid\n",