From nobody Mon Jun 8 12:11:50 2026 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BDBA3CC310 for ; Fri, 29 May 2026 10:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051559; cv=none; b=S/IBvoKLZ0jN6W4CVV4XnjXafABqHIWL2TkZYuzZqzaZB8l7GvB9dXVrwVmPwBUYPCllMNOel+szzQlrQxVo537s3UYy7fLoOEbDNnSQT0kbJ3A6v6TQGQDANXyrJOxqHIC5ffw0oo2ml3BOTUQW1SPPfEMY3s5ZyJ5IR1o826k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051559; c=relaxed/simple; bh=gefyxywsiMBSr6d14j+d4bay8IyQt8dXGWBKJWpislU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=be0wws3eT/BdxpU5hc7z0AIehd0AQTKDHo0bnXLZIGt5MG1jm/jdQYg4rgbu+Nca2/fQOmaJAPlOPK/ka/V1CNWv7IWtvCyi63oFjIxbDgQWLGvSKcILav9A4u39Rh+R7R29qc8ity5+ks6o1JTmLaBT1WmwVwWtnZQhHjBCFh4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O5sutoLL; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O5sutoLL" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5a875ca312eso1432825e87.3 for ; Fri, 29 May 2026 03:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780051556; x=1780656356; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7OXH2+flOB/VPx3klyh9xxXOIX/pTbIIlXVLEZ4fguY=; b=O5sutoLLd5tTbXz4l0n/TvXi6ebjd6U+gSOdcys4AHKVotpZm/s2no680ZouY9NWU1 e2B5YnA+AkZV2ebf1qEfSXhOHGV6yjID0vXprGr182E+TzAc0WtLwObzzcgpH7ZK7Qdy xtUCDQMVlpVi16J7Zw8KLmgVFMjCZ6k0KOq8PsL7pWMx4XcPU+F+r6lBE4dYQrGrUFrT 1K8GsFSaWGSCjnPhFlWN2t4Wm7M2+y7oj4iexak578A+oy5cxenbYwfgSdLYSVxoA/2j 1XYziCzun6TqGqmkv/PWaO/NFrZJ6LcqUtKyeKLyuy8cKoiiYApqO71woztFW6xbG8Ng mmfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780051556; x=1780656356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7OXH2+flOB/VPx3klyh9xxXOIX/pTbIIlXVLEZ4fguY=; b=VtrGktTh4l4QdOPzCjtyQ7/7av9DmL+CCKmz3l2+qSE7aynJuyKtS/78UbyRWb1hfM UrsjW1nTWT/jGcrcpdRA5f72PIxcgQLW87oVmcSBWknB+behYAIU67qBhbVPzpin0BRd zKotYsdBk2ZNWcvMu9BkZLFboLjmvwz2fnoVTEZY0sb9qaVAbaVh8JM3BQp19LMvdoC3 FFssAL/+9bltV52PNX8VOX/KNB9GBE14jGOtuUzxmHx1gnVEFgbxJ5lfkLcbgawvj8SF mfQY411Q9LSpdatvRejJlCwJc6SbFmVG9bOpyMnIeE3wSi40kXtqsEDVgWvUsTr7FSMc 7zzA== X-Forwarded-Encrypted: i=1; AFNElJ/BCCF4H9mOS3dS0nAiG2wOcfjxwPWCroiFjTGo3XIwaX4E8+6kXPu8GqR2t1QxEs1Rf/l7VtGNjsH05L0=@vger.kernel.org X-Gm-Message-State: AOJu0YzIl1mvatanqnIMizm9dFgWaM9BWb0LVhRz75rQemzLLt+BS+jA 71eenLHACHHVYJd4+UzgUSzBqVHfLiOSSTbF/J4JjdZ9cA9pSZDHNqADtCtv2Ftd X-Gm-Gg: Acq92OGAMUoOXv29q6irfGY+VcUxih7yZO1I1Jr+59qa1M8+SjLWfAOeyyfXZQaoqwl RRc0ODdkz8yKpSBqNEYBvfNsvy3z1za2ThYukd3JJRutZmbykThYUEa0Ge9JzLqyC064x55joP1 X5HNqe4Gc8mIl9gifdGl4kydeR2HpGSQ/MFstVca0HhB2FVLk3E43j0HAR9y4iJOclJBTi4aydu ZDuXrUsGpdxthQCmgfoZkWq6Uf5TuHUdMWzhiiLRX94/RLwk77CJHgofqPfsRb3NSiTOSDLlScQ isxrLXjt41E8IGhtUjj5IG1RWL3keBXtFd7ZKWIj8T6nZjjs7b916gzXLDhCg6vIQRKGR+QXtZT e0YHMRE7EttT5A2VwLPZtLgojaALH2bdr8KWO7Uwn2dukvonnucBozpiiKr1SV3RCP/PUNgPA9l m55wm6s2Ku4tceRpGcO3TlfixmLwcJl+CE35xOZHZbHpgjS2y4aexAwss= X-Received: by 2002:a05:6512:3996:b0:5a8:7218:47b9 with SMTP id 2adb3069b0e04-5aa594c30edmr358949e87.8.1780051555661; Fri, 29 May 2026 03:45:55 -0700 (PDT) Received: from localhost.localdomain ([94.158.61.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa5b788811sm192604e87.63.2026.05.29.03.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:45:53 -0700 (PDT) From: Stepan Ionichev To: jic23@kernel.org Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] iio: light: pa12203001: use devm_pm_runtime_enable() to fix probe error path Date: Fri, 29 May 2026 15:45:41 +0500 Message-Id: <04c4962d435d4df8e8ce6655598c0964014392f1.1780051096.git.sozdayvek@gmail.com> X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pa12203001_probe() calls pm_runtime_enable() and then iio_device_register(). If iio_device_register() fails the function jumps to out_err but the existing out_err handler does not call pm_runtime_disable(), leaking the runtime PM enable_count on probe failure and on subsequent rebind. Switch to devm_pm_runtime_enable() so the enable (and the matching dont_use_autosuspend) are torn down automatically. On its new error path the probe jumps to the existing out_err label so the chip-disable cleanup stays in step with the rest of the manual unwind. The pm_runtime_disable() and pm_runtime_set_suspended() calls in pa12203001_remove() are dropped; the devm action runs after .remove() and handles the teardown. Signed-off-by: Stepan Ionichev --- drivers/iio/light/pa12203001.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/pa12203001.c b/drivers/iio/light/pa12203001.c index 98a1f1624c75..b9f50c9070a3 100644 --- a/drivers/iio/light/pa12203001.c +++ b/drivers/iio/light/pa12203001.c @@ -372,7 +372,9 @@ static int pa12203001_probe(struct i2c_client *client) if (ret < 0) goto out_err; =20 - pm_runtime_enable(&client->dev); + ret =3D devm_pm_runtime_enable(&client->dev); + if (ret) + goto out_err; pm_runtime_set_autosuspend_delay(&client->dev, PA12203001_SLEEP_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); @@ -395,9 +397,6 @@ static void pa12203001_remove(struct i2c_client *client) =20 iio_device_unregister(indio_dev); =20 - pm_runtime_disable(&client->dev); - pm_runtime_set_suspended(&client->dev); - ret =3D pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); if (ret) dev_warn(&client->dev, "Failed to power down (%pe)\n", --=20 2.43.0 From nobody Mon Jun 8 12:11:50 2026 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10F3B3CE0B8 for ; Fri, 29 May 2026 10:45:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051561; cv=none; b=LKdNjXdbSXnPdJzZAhRQRr1A03YxvcgkCdvKEPLpCVpZJdmyIa/vTh3hhvFt18gZ7MZ89pbYuX+lOa4W5RiKCX3dJ6aMVY34876b6xZNlnu2V4KoVw3neRUYgmSQgwFGDOsAzyTw+6ZNVQCMO4HCyKBLTy3osuWIqZzMK+/HbhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051561; c=relaxed/simple; bh=audYFOC1F1czBfQ12j4ij8tbLhn97+qowaIfjvNDfss=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F84GDcbrDo5/flukhevk1sCwTYmZA/ppszVGM3UM0y6M/zjU8BfNeXhScUZb0nDw9xnh6Ed4dNchmm0wLokj3O6nAW8hrAATzYX39PqDKtg0bdIFjQH3tL003bV8xut4BjSHRHPDtzg3vco8U9xSSLiyx8R3QDDhJXsHOw4cnm0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=tHWFjNOm; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tHWFjNOm" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5a8e387baaaso1173008e87.2 for ; Fri, 29 May 2026 03:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780051558; x=1780656358; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8RX6HPkvTVnTrWIRcVhe8QYP1zROuwlfOtGDPwiQtAU=; b=tHWFjNOm6jjRdTQM6Nz6v3LEvWzePYkbZT8fiLPKzTooJWVUrucr2OPG7YLIbMc2Cf wbEQWOkCjrhtT4D4VRYRc2AY1x91Px4xSsbm0MQq+4DPhavctbPcSVTO5HrXf8SEAOCm ++AlpOkMD9fvIj8KIVwVL9kLIwx5F8iIm6KtuQwFk2U3o/m3avyohcWvu7Xhc96hb+Hd EOntw6x30fM9XTNLqAnV3HnXp1QdQGGy4YYp2HJIgQTZIIS5Rcq5+jHipEZAKAy2i7FN MCklgGj5F4OmH/Us+N27V29n0solXAgwGSu+wosfK5vkbW91ztAf+54eDy9txwXFOaTq UIsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780051558; x=1780656358; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8RX6HPkvTVnTrWIRcVhe8QYP1zROuwlfOtGDPwiQtAU=; b=PgL6hnCjHfTj7l2rcxD4DASoiRTMJsQisD/58cZIGiHqeiE4D69IHbKOnpDX4b1glY x3a7WMmDiGDWMPBWwD3lXNvUZAWp+gzy49tuVMOVyqlnIgL6h/l+2mK0l3EhNOFO5uzk n0L1rzpGudcCGvh9GSWBEnK/PDRZoJHDVFNaaSfmjPbLHC53064YcELcyklp1yShNFvE dO633dHBqVxw8G2ZFuDOzPYPGjPwwzy3ttOb+A7Qj9d1U3BOMi+/4d3JhI8ATusS/E6d /ARiVowZCIDmOL04oEPALbqJwjOcvqbU7jv1pBTgksIcbM8Sa7p2KgN3o/39FGHmXRzI woOw== X-Forwarded-Encrypted: i=1; AFNElJ8nSbgDUrC+RvFidWusHIGQVBso/vsdf/kO0AkwnxKwtaXghWBKz1tNta/ECl/G5//EHHOgypA+DvQ62aI=@vger.kernel.org X-Gm-Message-State: AOJu0YzAZukan69qC/84VF6gmxaRu5D/Dldt8gY/sxEBzMI5/Y/7vUQZ L219uqJXI1EhvCslHEtdleeI7GE/Na2VfirlJ7pBsdC1PqRAvZfF+MHo X-Gm-Gg: Acq92OHtgW/N5ZCqrycC/wVT8ae6VrHxTzajNk3Bsm9tAsjzuFRAKWdz9i7eHD8/5nt 0zuacdqDpLhE2CIac8gVY/2OH4xl9HpBQcBxyaX6RtT5Tnd3NtxeM0HHRVBeH67DsgFwiDu5i80 rxCwK0xrgDV9D+5E5/ktCjFmeCV5OCrYltWFghCHNfRoVl+OGDJoLwl3/KaQhX0UIIHuXxQ2emU iNA6JAnEg+Od/kICru8pCyHbjxY4pce29CzCL6MH91bx7zUCi0ZfjVCHR51nYw6C6qjMCnsHFuQ PzSQMGcU/GLeZtZrQVQKwwHEC5t/bO3t8t/yOZ8KaD5M+pWpclEPuprSNWfvD71+bsT+9RKZs9I eqqb3l42TDY7CS+34FFS63VDKkpU0HpjDipSDHWb6dlrykqNe6G/xnZSUZszSTYSphNswC6ro6f 1SKJEogrXsbHIhw9vSFXUyP2RTvM4mx0/3eNnmTpAYSyEbPtzkvuB13uo= X-Received: by 2002:a05:6512:3988:b0:5a8:7396:63e3 with SMTP id 2adb3069b0e04-5aa59523751mr306571e87.5.1780051558250; Fri, 29 May 2026 03:45:58 -0700 (PDT) Received: from localhost.localdomain ([94.158.61.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa5b788811sm192604e87.63.2026.05.29.03.45.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:45:57 -0700 (PDT) From: Stepan Ionichev To: jic23@kernel.org Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] iio: light: us5182d: use devm_pm_runtime_enable() to fix probe error path Date: Fri, 29 May 2026 15:45:42 +0500 Message-Id: X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" us5182d_probe() calls pm_runtime_enable() and then iio_device_register(). If iio_device_register() fails the function jumps to out_err but the existing out_err handler does not call pm_runtime_disable(), leaking the runtime PM enable_count on probe failure and on subsequent rebind. Switch to devm_pm_runtime_enable() so the enable (and the matching dont_use_autosuspend) are torn down automatically. On its new error path the probe jumps to the existing out_err label so the shutdown_en() cleanup stays in step with the rest of the manual unwind. The pm_runtime_disable() and pm_runtime_set_suspended() calls in us5182d_remove() are dropped; the devm action runs after .remove() and handles the teardown. Signed-off-by: Stepan Ionichev --- drivers/iio/light/us5182d.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index d2f5a44892a8..ada75f710bfc 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -880,7 +880,9 @@ static int us5182d_probe(struct i2c_client *client) goto out_err; } =20 - pm_runtime_enable(&client->dev); + ret =3D devm_pm_runtime_enable(&client->dev); + if (ret) + goto out_err; pm_runtime_set_autosuspend_delay(&client->dev, US5182D_SLEEP_MS); pm_runtime_use_autosuspend(&client->dev); @@ -904,9 +906,6 @@ static void us5182d_remove(struct i2c_client *client) =20 iio_device_unregister(i2c_get_clientdata(client)); =20 - pm_runtime_disable(&client->dev); - pm_runtime_set_suspended(&client->dev); - ret =3D us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); if (ret) dev_warn(&client->dev, "Failed to shut down (%pe)\n", --=20 2.43.0 From nobody Mon Jun 8 12:11:50 2026 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDFFB3D092F for ; Fri, 29 May 2026 10:46:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051564; cv=none; b=SS/xty/F056Z1fXkx6rH5LZCWrgMTntDuiu3lnn98i+/d7FOj+Fv8um6ftttB+b6jF0vzzgGU7GVRGgVFEcd8qlrJpzSZQDJCbTxYyDXGhibBTYcRxIb+100wvEUxsB288fYu3GBlJ3mZpXmH9UL3qSlA/Xdv9ifROSoijlK6eY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051564; c=relaxed/simple; bh=Ds1IePhPH8cdXoDJgltMRTsR7yErO+r38H8TLfydJzY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tiePYJO4ehXbAuWBbMXqcU+r9o+TFr8qoZRRgJwPye6DkzxgSC7G7SUO42wneb+it/dLzErplT7k4zjaC/dgrwo5tJ2jbmdMO11JKtYw5ceheTKySu8HQVzSsJqRRBNtXSpHz267z1OJMLl07PxOJMfHOJf5Av5G0ZpZQumAQ/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aYblXAsC; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aYblXAsC" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5a41a9a97d3so1082965e87.1 for ; Fri, 29 May 2026 03:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780051561; x=1780656361; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QrkG2GgwE7d9GVC7/yBvpw/L+5Pl56q+Sn4VeitLYBQ=; b=aYblXAsCqDdv+KXBmqJqehuByOZaXVLkINp9BGpq5p9+cVg6HJU+ysT9lFt7WFfsZg LP6e51rR4qcS6ut0KUqB4BB8Onca8L8aUABSq7diuDB7nZIGBedAbqNZJKyKjw2RinsL HGngoEQFp8CulNqE1hZuPZuN881jNz+syWpfxQfubPt9rNZ8EeA62lQrMlEMupu2u+9j 6+CuBoppG7iOJu2/YDta9P2pRxhSv+YbT+fIWNT4J8HTQ8jPEIUsg9PYkj8Z1RoXFucj 8aU8rFuK7wlDpO/1At44YuoKL5lWZPY4TFEs35dLKQsc2go5ArjZ9FhWtCiS+5EhxpZf lCrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780051561; x=1780656361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QrkG2GgwE7d9GVC7/yBvpw/L+5Pl56q+Sn4VeitLYBQ=; b=Jjbvs7Ys6f4PZ8Wkcfzk8ICpZrbPgUw9j5Sh1qfLxRlDGeT4M58ilUzNTdFtzFcBvu TG561gjJNlLNS4opOp+lfkeotq0q16nXb79arexJ9EFHq8F5rtTy+f5UfOva+dzwTp6D 3bHY8/+Q8Ti7fwZJRen/FhMOMDlMpNzRuQjgTtD5MX+Q7hMabj7JLBRsmN9ldilFF6ai CfJNweOEQu+iozEYTaqIWGklIinSGhWOK9SgjNTL2C8mnr+GEIfDIfWCKm+fuHtjsdeQ I+fOMPsiZiWVrMumgXn6mYuKBNiEPwGE+fWRbVAvmOH5zjcRKqDBchyzTHBxtgmmJd6k qa3A== X-Forwarded-Encrypted: i=1; AFNElJ8qCCVmLXbd6Gfj0nuJgLQqXzBvRsDKJmzT/E3M01VNg6QlUScATXKkvxqnW2fK1+ipPxDEoT0zq120i1Q=@vger.kernel.org X-Gm-Message-State: AOJu0YziFrJLIqjlJ32xLPKGkUjqyggYSdD6aBPTjy4UwJoukMicda8i t6Jjat/TxPZHwSlcQB7kvnMzlY0R3RneT0Y6aam/lI/sT5tVQOlgkvhijCOaIT0u X-Gm-Gg: Acq92OGUy5uVdqPpiDPD/9xTLvePhwpwBPikTj5VzVtfip/D0Wp0bNjEtGYyd++mv8w JmOAEDtKIiyiong5Sh4vDPWhRaiO6Aw5jlvtY5q7NzjPc6/N+57aiQN0ZwRlzb7P0WT+T+LS44l F0SDMFXqDLf/zt0Pt9hc2tfX0lVzrH8imaidoQFF7XVh5rc963yuOpXNbd1/TiM43NKdx72SZrM RQvorWX6nWa2tLUTR4TQU0Tsgv+sybHFgCkvHg9mTFNZkoDHHt+MAxlywiqdL6m7dJXQvq9qylK xYFoT/apLvp/qcEMmHpFslsZX+DiYb81dX19uzXnpm1EWWoG9i4Z4N5OmkiH/zC45pmWrED/8Th qcttTzlwiCjBI9xZChqMu42yqQYLu42zVtQXQXgpGRfVSJb66z9x4kFHjikVB2QpTk3rF3fi6lU yAre01LzBc7ZohCV0Y8pad/sPcBDaCKtX/54eTQRdGm5C6PAmP/S14KLFeWKxfbpfW4A== X-Received: by 2002:a05:6512:3a85:b0:5a4:18cb:8850 with SMTP id 2adb3069b0e04-5aa5952acc3mr285910e87.6.1780051560916; Fri, 29 May 2026 03:46:00 -0700 (PDT) Received: from localhost.localdomain ([94.158.61.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa5b788811sm192604e87.63.2026.05.29.03.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:45:59 -0700 (PDT) From: Stepan Ionichev To: jic23@kernel.org Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] iio: light: apds9960: use devm_pm_runtime_enable() to fix probe error path Date: Fri, 29 May 2026 15:45:43 +0500 Message-Id: X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" apds9960_probe() calls pm_runtime_enable() and then several operations that may fail through goto error_power_down, ending with iio_device_register(). None of those error paths call pm_runtime_disable(), so the runtime PM enable_count leaks on probe failure and on subsequent rebind. Switch to devm_pm_runtime_enable() so the enable (and the matching dont_use_autosuspend) are torn down automatically. The probe error path on devm_pm_runtime_enable() itself is a plain return because no hardware has been powered on at that point. The pm_runtime_disable() and pm_runtime_set_suspended() calls in apds9960_remove() are dropped; the devm action runs after .remove() and handles the teardown. Signed-off-by: Stepan Ionichev --- drivers/iio/light/apds9960.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c index 785c5dbe2d08..edbf149b931e 100644 --- a/drivers/iio/light/apds9960.c +++ b/drivers/iio/light/apds9960.c @@ -1074,7 +1074,9 @@ static int apds9960_probe(struct i2c_client *client) if (ret) goto error_power_down; =20 - pm_runtime_enable(&client->dev); + ret =3D devm_pm_runtime_enable(&client->dev); + if (ret) + return ret; pm_runtime_set_autosuspend_delay(&client->dev, 5000); pm_runtime_use_autosuspend(&client->dev); =20 @@ -1123,8 +1125,6 @@ static void apds9960_remove(struct i2c_client *client) struct apds9960_data *data =3D iio_priv(indio_dev); =20 iio_device_unregister(indio_dev); - pm_runtime_disable(&client->dev); - pm_runtime_set_suspended(&client->dev); apds9960_set_powermode(data, 0); } =20 --=20 2.43.0 From nobody Mon Jun 8 12:11:50 2026 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EACD3C585B for ; Fri, 29 May 2026 10:46:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051568; cv=none; b=B0dbUFRrylX7G46MqqON0mGMtv1tSisUHzD+qCfniTavB8HOGKPypYOEX7TMdui4dnZ1/tgOtSv//fH3gFm3Ad2OEmhe+KejueNtCOS7XBCknlCfYXXc+UWUr0y5PNwPOdnXpJXd7EgkPBI0qQBoYrH9KUfYNBGOxY5CLFOrtac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051568; c=relaxed/simple; bh=BzKay9Zrgr8HUXKy/Wnq91DkIwvyoKa451n4hP++RhM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CEoSSCkKH7lP4tlffJNvkONfKcaVVjpS6A8WlCXZuz5DDPUAPj4BoMGyB3Jxv0zvkwZPPpB9elEdxw2jr68PfNtz/bxBr4crmdzsbBAL+npjJcGs3xVcj3Ev+FhnCUsgxY2TksRN41+MEUuu8gxUJezb5XoNHgqXck0FdYeCrxU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gE96DDkw; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gE96DDkw" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5a8ccfcbb3fso1352397e87.2 for ; Fri, 29 May 2026 03:46:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780051564; x=1780656364; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UilomXHH4waqyt5qI9rlYVpSlWxvQ+5JxykD1SfQgw8=; b=gE96DDkwmsyBQIhZSOLojF/cyIQYToHk54Z5zs0HukxE+gQCr0W2psTL6d4xFd5iTL 5pGVSCOlLAa2vvqvgqqFCHM9s/dypvOkVAfk/MxgC+1mCQxkPRACKHgv3c5xNGfp1YPV fXmB1ptwLHONtZFchkxNK9neXFsKiqatiWR3mh4qYx02tgB9Q/QJYm27LMkCL/HWAcLF 6UffA8DrEllrUxZG9EYDEGU0EVXLgLU3Jd0xgM1RPtiUSz78eI4jXLRJ2m5hgZRm8AiD TDLBQs4TeO/UOqYtbde/IM4P8FkfEHiU7RvcE2cn1MwjMq380zml30wBc6+Tp+XD2BQX h6bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780051564; x=1780656364; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UilomXHH4waqyt5qI9rlYVpSlWxvQ+5JxykD1SfQgw8=; b=fsewpEp9fZcvY5NCgnCtoKLt2+2/f89uSzGFkrcYN3mKnODwMCJUDlsUKgZN8GLe5t pA14x4dixCOy7sRzutDhaZPA/FDWJiw9zgqij6K2XeN+lW7vFC4h0wzHjMGpqRnKNi63 xIPSMWPHxIk1YgHSEAsaQ5uK7zm47/5fA+T9RRsCn7nwjARfD1Dx51R+4+YEV+eD3X+b VPScFrmlER8sadG27uboCOEoKgJGMQg6H1bmRk2ejmzt7HxUwFRPcaX8CfM7tSmxZm/l P0I7WjeNQ1rGX050RvhNme6WtvX3L84RC9nSaIo/wE3gs5WI+JpickSkY+FKlzrfwo1E VvEA== X-Forwarded-Encrypted: i=1; AFNElJ/qKone1NcfhJLt8PH1KY49Pem68CaoLOxE9w7YqnBqwdSsg/zFjnEGX7yTJszLfPVkhiE3ikw61iJUUlI=@vger.kernel.org X-Gm-Message-State: AOJu0YzhdohhgKNAWeqNOD96vfTrtGKg94m+jQnYghe+Qlxmdzlg3Hnx agYHislf+xXyQvKOP/iNbJaewm7hSIu/s10N2eTV7b3+8LTw6tFFbvhi X-Gm-Gg: Acq92OE12xWZzCvYCKxfCJlziRPEoV3AKIYyZWcBEJmViHD209eOOc3DbbnYb1QV+Xu HQGrifhznlwJx8spjv4vhfMdxpM7fhcBbdVdVAMlkRim0jaJPcfXki+1zzdpiB5eqRdqPlsRakb MVuasrKQRU8nTAzmK6gOV414l6Ks1m6hBieHDOV6gUdZEQVVshLLRtUSc2XK0si5CoS+inGKgCs lbF5Whsl0gNcgH2GhaTjWebi45r4rSPT6yzukPQR5PRaeFsmRAsTz0ZX6GPGRmYea44UYUXvm6/ 7COHvOSIVOi/MUdTWFV1XdyyAhavIYpfsG/yr4iRsPccV0b+UAIbKH2MyHTO49DBUvXV+pqT1NY dduNd63vj2U+CVrTGkHxKoTP4Hm7OcskarmiY86x92CD0oaALg40BSfoa9Wv7l4rhV4jbE6oQRj JUPJPqbfrypx4EU41wP/daOGMYlRr2QBStJSpoOhlznY8hLJ4GLM/vnIQ= X-Received: by 2002:a05:6512:3a8a:b0:5a8:847a:dee2 with SMTP id 2adb3069b0e04-5aa5949d066mr324829e87.3.1780051563496; Fri, 29 May 2026 03:46:03 -0700 (PDT) Received: from localhost.localdomain ([94.158.61.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa5b788811sm192604e87.63.2026.05.29.03.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:46:02 -0700 (PDT) From: Stepan Ionichev To: jic23@kernel.org Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] iio: accel: mma8452: use devm_pm_runtime_enable() to fix probe error path Date: Fri, 29 May 2026 15:45:44 +0500 Message-Id: X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" mma8452_probe() calls pm_runtime_enable() and then iio_device_register(). If iio_device_register() fails the function jumps to buffer_cleanup but the existing manual unwind does not call pm_runtime_disable(), leaking the runtime PM enable_count on probe failure and on subsequent rebind. Switch to devm_pm_runtime_enable() so the enable (and the matching dont_use_autosuspend) are torn down automatically. On its new error path the probe jumps to the existing buffer_cleanup label so the triggered buffer, trigger and regulator cleanup chain stays intact. The pm_runtime_disable() and pm_runtime_set_suspended() calls in mma8452_remove() are dropped; the devm action runs after .remove() and handles the teardown. Signed-off-by: Stepan Ionichev --- drivers/iio/accel/mma8452.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 15172ba2972c..88ed47d33e03 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -1693,7 +1693,9 @@ static int mma8452_probe(struct i2c_client *client) if (ret < 0) goto buffer_cleanup; =20 - pm_runtime_enable(&client->dev); + ret =3D devm_pm_runtime_enable(&client->dev); + if (ret) + goto buffer_cleanup; pm_runtime_set_autosuspend_delay(&client->dev, MMA8452_AUTO_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); @@ -1733,9 +1735,6 @@ static void mma8452_remove(struct i2c_client *client) =20 iio_device_unregister(indio_dev); =20 - pm_runtime_disable(&client->dev); - pm_runtime_set_suspended(&client->dev); - iio_triggered_buffer_cleanup(indio_dev); mma8452_trigger_cleanup(indio_dev); mma8452_standby(iio_priv(indio_dev)); --=20 2.43.0