Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2399958lqp; Sun, 24 Mar 2024 17:53:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWp5OhEISyRZrHDVbMPUMC8MtErlmFAVHDlG6/ww/mntaXCisNs1kplm58cC881h6up7YDqhY+JezSmA38mZaXLMUhCCzNm8+mpIcfERg== X-Google-Smtp-Source: AGHT+IEppZuYNh1tol3uKCqFd1HVN8WV++tT3CiyTDPZFzMxCbBrFLk6RPULWjT8abgiOz4Zl37H X-Received: by 2002:a17:906:3993:b0:a46:8c9f:f783 with SMTP id h19-20020a170906399300b00a468c9ff783mr4077457eje.67.1711327990324; Sun, 24 Mar 2024 17:53:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711327990; cv=pass; d=google.com; s=arc-20160816; b=R4n+kKIImTtn8oTugKxj4luLnifhylZLGvMzC2qCtud3nlZnxHq95cLLNQLu95YB/h IxZ2xwYyVrc7P4mN2QJnKRFWwxC1NA4AHh1iyTinbA+Xet7Izn2l/WaznY0+5Aa7dX4F H4sYqBeaCASJNs7yIANWQRp68td6xb3hytgwFeJaxUG/qx9hQAr3tCE+nRxQiz/W1X0b hdqgCqD4mmj2eFdeqjCysV0vnCuMeRDTSU3B5Ww8NEgPmulyujQJ3Xli12bUrAjy/hlM uX/evChqDdvNA7VfxCZfUk2Gc1A78FmmSF3bEgMQcAzVY8ZtKh5PLE4ylyRarvO8lEZW kpHg== ARC-Message-Signature: i=2; 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=IgDidq0MsyCIircLuc9bYYwJHIc6mzFFSuk8cChATtQ=; fh=P4FPnYgIUVHCbr2fVhJXRGE6Kaagzv1Kkft+aKehl/0=; b=sWXjYQJxqPCYluhyr7iW9h0aXZ1xQ98KVz45S75T2RC9b4BDSpPI0B4X+gfhiJJaUr +3OrBaprCT92e5yAGvu+7wVvBa2PvZSuXaF8OIajiMB/WUiOQFFzitWXNAkr25TA4lry liyhj6uYoO31eC4PVUC1ncxKXWOr178p5wFaB3BgLb4AL1zOAUPJU3RuGxgIL/sMe15y S8uQuGPZc4/Hrri2YH/QW1YU555UrTTeB/0qW+F/BUPlV646+VZhfBp9CtNPrBhAjB6M dEaFD5v9OZBOMdmSan3esJQVr6HelyaAyeQMWLMoN1PqqA2mhTIDN82t6ptl7Vrfy5nb iWTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A3519hdf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113501-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113501-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 22-20020a170906301600b00a47377bdec3si1991215ejz.150.2024.03.24.17.53.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:53:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113501-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A3519hdf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113501-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113501-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 215031F2340E for ; Mon, 25 Mar 2024 00:52:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE16F13D612; Sun, 24 Mar 2024 22:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A3519hdf" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CDA051B9DD7; Sun, 24 Mar 2024 22:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320302; cv=none; b=TDSM3ZAow8AXbZB7aT7fN1GDv/lJ0p/mL67t3fw7MKtVGxgqYl1p9p/a38Q3nIN4rnPnWw4HPhbBMrQ79idYGt4ZSan4P0no4ALO6GcRK6XfC59AQHj7q1clkb9kFJmgaxRi8WQdDjT63S5w4BsHi7ZQf/Wd9/vIp9wE8I3T4Uc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320302; c=relaxed/simple; bh=YKSk4417jnkaegNrpdi4LwpmOOlK3FepNJNTBW4pIRU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eHyokJ7ZtVcWNXaz3P2sHOmc6TAQ9SMsmivS2j1YICdONOgmP5wEaPBGEtUDyBde5Mq1lE08SN5Ji8esH1zNtKIug32OG294/cPhyAYPQ4uCSPPhF5L/6iUJG0SWotXWDCKCm3GmRJz450NbtVEaCfISg0QfU6iCXExNhZalDHA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A3519hdf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF966C433C7; Sun, 24 Mar 2024 22:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320302; bh=YKSk4417jnkaegNrpdi4LwpmOOlK3FepNJNTBW4pIRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3519hdfksTryieY8M0TLD24sLDxSwpWuh2vDbPfmABKbweix+0Mcsybp8qbHWMFI u6x0crL8UXNo/AVvNjdzAoZI6QRXRhcsTHDdP/i97ZxhAAikD34e17bB6Fy9kBu+77 qgVF3qtHGkhmAcQPp2beFKsrTMesr9rx7G+lp9W7swidX8bc9182lpoZ1jpJ4QCjex Du+1UtRAoKraEgBYMVpFP8K48i0zH7aFvPFcxvps1vcS9UIuS+slh7rKqtXczHrArg /gSM8lXkOcaCNf8062RDFUQpUB1AOW7GnqkjzSIt0J0gpa4HxAJX9UlbK7HC3QsmXe WhwXH9nsgjWQQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Petre Rodan , Andreas Klinger , Jonathan Cameron , Sasha Levin Subject: [PATCH 6.8 610/715] iio: pressure: mprls0025pa fix off-by-one enum Date: Sun, 24 Mar 2024 18:33:09 -0400 Message-ID: <20240324223455.1342824-611-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Petre Rodan [ Upstream commit 9e65506ca9c7ff716c8441a33417820ad61d3a16 ] 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 Link: https://lore.kernel.org/r/20231229092445.30180-5-petre.rodan@subdimension.ro Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- 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 30fb2de368210..e3f0de020a40c 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.43.0