Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1893431rdb; Sun, 24 Dec 2023 06:35:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwhmm/ai7Ltc3QLByu0/9bE25XpgrJLbfsmtqFZy4MCjvAuQnCICSCt9QVj4vvWfMCotjO X-Received: by 2002:a05:6a00:4c15:b0:6d5:ee7f:5963 with SMTP id ea21-20020a056a004c1500b006d5ee7f5963mr5103358pfb.55.1703428557367; Sun, 24 Dec 2023 06:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703428557; cv=none; d=google.com; s=arc-20160816; b=dzH/LxkoMiUwI3BGBwUQcYs0YDmYUAYUjycAwa3wCvrolksCG9Fp0eUDflRd2S7Fon A7rqEIVcjqGz9n++m5y9rWgkhRMOFs76VhQ7+mUK+VJh4K5qfsB+f7vcAJR9ikox2ePQ udIo6oohFjvZrBFyuHHoiaisX3XwRmRWmxbTvv5wWVx5Jw10FXZgDUOExLBCS9NurMif rFSpP0OvYZIMqGctN2jTJAY8tORH7hO4FZP7YNnSR4uZt1uxDZ5EjxUARCe35MTZDzCg mQ5pJqzfjHXcuiJQ0S0rkVZcc8sx1f8GjVFzQDgJIzLovKFFFklMPuwBA8z99oNc9jeS 6dxA== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10724-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b4-20020a633404000000b005cdf95ddf8dsi3902857pga.271.2023.12.24.06.35.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 06:35:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10724-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10724-linux.lists.archive=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 0BD37282097 for ; Sun, 24 Dec 2023 14:35:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97FCBD297; Sun, 24 Dec 2023 14:35:21 +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 Content-Transfer-Encoding: 8bit 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(-) 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", -- 2.41.0