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 E3161317141; Mon, 13 Apr 2026 16:50:08 +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=1776099009; cv=none; b=KhX2yIVEHfBpri202usrG2WZhMWmH4Mzwf82QzOTnCGQnAYDBpWxWR4zcubVCq7Qwda/dZqe7k0HZeNje6a+dpcgewQWJhdwMeZAWOb6ZfUNpsoRXiUX8Pb23dS8yk+4Whl8lmKt6bL5kN1Zo5HsSj1W9AmgT+f0Jz0ukHwLhYE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776099009; c=relaxed/simple; bh=5yBtRrCgKVvhDIh0ROX9Y14p/8oYGJU2DB85u6Okctc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=miNpGElGwglEEIA8wTHv1rh9brWz8ZSJ4CJFceSqpa1y42pwnRBjWJWXQKVkJuf21xUkkZMDQXc6B+kWuMfL4Y2ZWhlno++J3P97KEs/I/dHJiBHdjj11mLW7qDh7SXl0xxMlz2K16tigEZLNhNNpCI1oqYWUiXrS9JemjteZXI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IO5rdOXA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IO5rdOXA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E4C1C2BCAF; Mon, 13 Apr 2026 16:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776099008; bh=5yBtRrCgKVvhDIh0ROX9Y14p/8oYGJU2DB85u6Okctc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IO5rdOXAoW+n9RqmuwRmS7UHZ4Jjzr3k/zQ27v/7KtR+GXQe+HqC1Hk7/ccduNHUR 366V3HI56MdRVqif1mZK34XLW2OGjsmjgz5L968K4uu/E6GPnyRLATYlMlzklga4I/ ciuJAWndX7e9ez1SJipxuoRKyY5PEduNDRoIug70= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Antoniu Miclaus , Linus Walleij , Stable@vger.kernel.org, Jonathan Cameron , Sasha Levin Subject: [PATCH 5.10 173/491] iio: light: bh1780: fix PM runtime leak on error path Date: Mon, 13 Apr 2026 17:56:58 +0200 Message-ID: <20260413155825.524617814@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155819.042779211@linuxfoundation.org> References: <20260413155819.042779211@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/iio/light/bh1780.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/iio/light/bh1780.c +++ b/drivers/iio/light/bh1780.c @@ -109,10 +109,10 @@ static int bh1780_read_raw(struct iio_de 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;