From mboxrd@z Thu Jan 1 00:00:00 1970 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 3FDF43BE165 for ; Thu, 19 Mar 2026 23:01:13 +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=1773961274; cv=none; b=iRdaSlM1hgt63cHFHRmu3FWn0NvQmguNrow+pwZLI6RCk9xtFWmLWN+nNgQCVd6nqJ37TVA2EnEeFVUNkf/rUqCb61e2tpHxanGbkC7AkEiifrSmpt2e5hrLQs4gdYimGhgc+ry+Ozkfynmso6OxKnwyIq12V/fhuF4VEdWOJQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773961274; c=relaxed/simple; bh=5EgF47M4/lRdWkOE2/UeAVqpghGBiIUrKPrXyMQI3vc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gKqiMvyF3DT4yvuLlldkhffK8F1IbUE8HfXT+FRWSPD3JF6JOxtrQYGOXLiU9gDYlRyAfxdmVwMxB4iaTlfak8YfpkEzSNMcLUaBrBiqe0B91Kvlb4vJph0wq4xJ0cKQFN4LNQ+n9RlQ9Z8ge/3W25q5/vlRwOvzW5iT7UrWI18= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PcevOz0S; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PcevOz0S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2701DC2BC9E; Thu, 19 Mar 2026 23:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773961273; bh=5EgF47M4/lRdWkOE2/UeAVqpghGBiIUrKPrXyMQI3vc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PcevOz0SkDvCCITvuQomrkn8JtysCAy2X4bEWKfldBlfc+V/H9BD33ZFjtVRss99W hEiHoGiRIN/oTDx/cT49BVa7qu0xwIIIS/Go6DJl2BbML+hH4wrRFM/WwYriE3/Zp8 ONO/sRDmynGVLX8dEAZ0f8EA+8PEkL3sdwc9P6mt1bY1x1RHSiHLzdj96VLJGE9IS8 w31NKk1Hv8NbLzibxdsn+gI7gTEio1wOwMkgpvouCgqExfili1nm7AtKxc3byXFdwx RPg8GMzEI1ZgjDOQo4WX61LWqJrBCY+3Nrwu4yy2g4CvkfJ3Hq/skZ+j4r1b5UQhKt HLpxwPZvkqi5g== From: Sasha Levin To: stable@vger.kernel.org Cc: Antoniu Miclaus , Linus Walleij , Stable@vger.kernel.org, Jonathan Cameron , Sasha Levin Subject: [PATCH 6.1.y] iio: light: bh1780: fix PM runtime leak on error path Date: Thu, 19 Mar 2026 19:01:11 -0400 Message-ID: <20260319230111.3146058-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026031707-pull-leverage-a222@gregkh> References: <2026031707-pull-leverage-a222@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Antoniu Miclaus [ Upstream commit dd72e6c3cdea05cad24e99710939086f7a113fb5 ] Move pm_runtime_put_autosuspend() before the error check to ensure the PM runtime reference count is always decremented after pm_runtime_get_sync(), regardless of whether the read operation succeeds or fails. Fixes: 1f0477f18306 ("iio: light: new driver for the ROHM BH1780") Signed-off-by: Antoniu Miclaus Reviewed-by: Linus Walleij Cc: Signed-off-by: Jonathan Cameron [ moved both pm_runtime_mark_last_busy() and pm_runtime_put_autosuspend() before the error check instead of just pm_runtime_put_autosuspend() ] Signed-off-by: Sasha Levin --- drivers/iio/light/bh1780.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c index 90bca392b2620..725cfd50d9e4c 100644 --- a/drivers/iio/light/bh1780.c +++ b/drivers/iio/light/bh1780.c @@ -109,10 +109,10 @@ static int bh1780_read_raw(struct iio_dev *indio_dev, case IIO_LIGHT: pm_runtime_get_sync(&bh1780->client->dev); value = bh1780_read_word(bh1780, BH1780_REG_DLOW); - if (value < 0) - return value; pm_runtime_mark_last_busy(&bh1780->client->dev); pm_runtime_put_autosuspend(&bh1780->client->dev); + if (value < 0) + return value; *val = value; return IIO_VAL_INT; -- 2.51.0