Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4436718rdb; Fri, 29 Dec 2023 01:25:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJ+lwVO1/21SgrS9UU7CHEz/S3CIrKiZ50BZN3vzfZmp4zyQ4oZbThkTXitTJY6xk3azU/ X-Received: by 2002:a9d:730f:0:b0:6d9:f1b4:c560 with SMTP id e15-20020a9d730f000000b006d9f1b4c560mr9177074otk.67.1703841941491; Fri, 29 Dec 2023 01:25:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703841941; cv=none; d=google.com; s=arc-20160816; b=cZRMdDEXU/nOlLOr2A6ZulviUo74EkFl0zfr3mphJug/zrG5PyJAjLkr1bR8OPWvWb vKiStcv+sj4S8erX8RiuHccqRrbeDEF5tchY9Uh0f0NMTky8wNnu1yr1I68ZRCBPSjn3 z53x1FX631YExcNxUXFrSuyKZXQr1z5EaF7L89UezReEJ34u/uFkZXVbn4i/ubY7OLUC Mc85RircxNy4HnJ7gLXS3GFc6GFMg9P8PZCXxIlMFhdRW8oiGtSnJqVKpOw6cExON8rA KsvzooRqZzDgdyKuoW8VsGd0sTatURyUj/lCnUCJ3XHi8cEQ7kM5g6JBBiK2SeBmpZ6/ 9ccg== 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=O63f8/hzdyKes3hDJBK2oZxWoRpxJhe44nO6oTdF5To=; fh=cuSrpdmFbNnIGKLvcD6905UtzyKVEbJe+tTFY3eiseU=; b=UhSHggFeJQXgH8WCyt073EPY9VGzXJom5DnE1Lgq+peEjt5lDoPLLVrDtYn2hutZ9C xX7vXdTVDgCR35VfS1PoX5G80+PjVa8iz9lwewZRNwmR26RwauUoZklanxnRuGGF8BHB Pk0tvmtgY7raKL0hBBKy5UDn0HJ40SnJXIf5apBOqGkM2r5TlG4Agj3mzzDBbKM0aiOC H9Ok+oixQjdenJL+X0LBF27Sw0TA7Bs+DxoL//Za/7MnprJs1qekI7+eR3PVAYNaZCfy QbTniFlY2Ic7fwEu7L1XvycbPEgGl1pVgoOru/CNg0DDTZZrztYqj3STMsTGigE9sAOM MAXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=m68GZYKJ; spf=pass (google.com: domain of linux-kernel+bounces-13028-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13028-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. [139.178.88.99]) by mx.google.com with ESMTPS id e7-20020a656487000000b005c6faf0a670si11999432pgv.257.2023.12.29.01.25.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 01:25:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13028-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=m68GZYKJ; spf=pass (google.com: domain of linux-kernel+bounces-13028-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13028-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 2391E281FDC for ; Fri, 29 Dec 2023 09:25:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B3C7111AD; Fri, 29 Dec 2023 09:25:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="m68GZYKJ" 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 520C510A0A; Fri, 29 Dec 2023 09:25:14 +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 0286628B586; Fri, 29 Dec 2023 09:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1703841907; bh=tlhYys3P3yLGPXxjY35bhZAwm+PVbm6Qq70uWBAQSm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m68GZYKJYu9MVhSNNAhugzNP9Hjh9U5xoPyi8ZIdCy19klvpOuB3MGfceyHvae5HW YoQcUZMH9ESCm93nkGIh9jPTzbonbnlw8HtYFYLBrrSncnm8T/FsYacqwY8hyu99vJ gXjOwsgFOChM9ADJp8t5RVqynNHf45lVMJolEtSg= 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 v3 04/10] iio: pressure: mprls0025pa fix off-by-one enum Date: Fri, 29 Dec 2023 11:24:32 +0200 Message-ID: <20231229092445.30180-5-petre.rodan@subdimension.ro> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231229092445.30180-1-petre.rodan@subdimension.ro> References: <20231229092445.30180-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. Fixes: <713337d9143ed> ("iio: pressure: Honeywell mprls0025pa pressure sensor") Co-developed-by: Andreas Klinger Signed-off-by: Andreas Klinger Signed-off-by: Petre Rodan --- v2 -> v3 no changes 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