From nobody Mon Jun 8 12:11:51 2026 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 52B76368D42 for ; Fri, 29 May 2026 10:45:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051513; cv=none; b=Wa1MvREkSson/9fXt7h3SvHxQVMdRs4wlAOdSJuuiBHuUTPGWw2lO05zQ2zO8MzjVkF/ZkzB4a40qeYYvK3YzrNvyN7/5z+AHX3YIFr8NAjEkDLP/HpRxjmSt5upDEnj5zI22Bzll0Nq9umz38tTynv9XUKXo9L8M4RZfk/dz3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051513; c=relaxed/simple; bh=QuD01jJQSvE8R5xMlmBpQ+/u1Qt6bvUX20bJXOgIMzI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BIPU2EKcaooKj4rR1lgLrsyR9W2RNJhex/sFVxcrIm2kpVAINSOVDbEZr0zVe7+PY2FSGi+ApYCnOS77uykJBbBASQoOEnOQcYhcXbvepj9Y0vvTXd1KJdhb5u5L7ItIiQM75cQe+cCgivhxGJ+DIYSrmGjUKsIhupB0C/z+UVg= 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=kcWrQNX3; arc=none smtp.client-ip=209.85.208.175 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="kcWrQNX3" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-393b0fa758fso18011961fa.3 for ; Fri, 29 May 2026 03:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780051510; x=1780656310; 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=xTiUmxm2e7d2JB+Cngp4w/ag6Fk1gY21uN8oBR9XC1k=; b=kcWrQNX3e3KO8yPWpgfvifF/oAj0BlruAgx1n0OUfs6Cxr1/vBpYDpqjarLI2E4ogu BItPCX8Q9cMAloU41ruXEVXEvXXag+mIScjaNEhkx9bq7+42THwRtOpGzOwoK+lEyu+5 qYinvPthzwz4+tcXX9wTqTXDux4nxo9PbdQs0fSgYjLTCz3Wi//qQ3+fFX4QN8NnzrOK ZiSp7b/3pwTXEJ3hoKhvqIBWv28uLA8OLMb31LT7lHe5wtl/EjjSYr74247IAKzzt1rx VOOxQDJg09Z1Vyf0cfM65QUszMZ5v78u57GBIneHKxVpk7QDoDbkZ5jfyqvCbIQ9O7dM a/kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780051510; x=1780656310; 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=xTiUmxm2e7d2JB+Cngp4w/ag6Fk1gY21uN8oBR9XC1k=; b=NsyIdA6Uqf0bWtyK9On7qT9kBjGJlS1ApYkBDF3AvDKA1SBzEZiLq45vcL8gF2SzcK mNo37HUK7dN0cr0HUDrCtrKlCQA7tdT5GTcKoeOTlA8UZTq/g0ZMozemshMpHNrY+6Ez He22sYZDwckMcRdrTYU4u0GMwDZ1AAJUQLmkSVTq5MbTA7rBqpF37da/OS45H4+loTfG rB9BCxbohyl/cH6Io9UdGXlsDnHM4hzjDIjFjPwSRAVPrRKN71A9V387zpsQZXEdFXpy bGCd3HcLdPVn2a3mVgmw1xW5ruwRlOf+SR2VO/FUCltfrdq5VKHNxt/PmkDg7a8nDai3 2UJQ== X-Forwarded-Encrypted: i=1; AFNElJ+2gaXmf3mLC1ZEqTbrMyNbYrhszL0MIM9I+86BV/pHQx2ldjGC3Z6E+BDEr8wCY3BE9TDmfzWBJIg8zFQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyxhKTR/cXnflJFfaRdG7kXy+cRrA4OHc82tBELHYHUWKZeZ4R+ zXqO3d76CFLl7Yu04KSr+wCNRIYeJXrQIc4Od2Y6iTahWgM7B5+RQPU/ X-Gm-Gg: Acq92OHpIKAWDG1lGYJE/EDEfGq6dltsNEEaLFbgiSd2yMUfFSCYHjvYE8ZI0AHLzUq 6fMJrD8F7ceKjQDuDgZjsvMLdu74skdFMfMR2Wgcyp+YBi1IIZsI68rLOXZFLT1w7ePxsgEJTFk 3FjKeicSOukO2mhVJO3nlFZCchygrnqskPX6+nM5EzZtxnKefwWgtJQaqTjHvwhcEEuRURlA5Qy v0PsEmegRwgOMgsb3D8ywQQNriHXJU6OfJydOfOKyAUBSaPRnksqWz+Fi0N7G6/0WfcM+MEmNHC wjVV1cUw36zs2V9i0xHyFusTK9gGkm354XERiy389s3aCCLb2M1ka1dMa5thyMr80xP/o+ym247 wbne8GoGUwsivhhw80IDXANfRQIKSN7WWARWJdgtIwFKEEmxHfI3p9Hcw6LplpU0rq25Safdp84 bb6ILkFiI0UTQ6Hg2nRp8iXRR54Hso9cnx1eHAmxEJfK+kr6HgsAGofd8= X-Received: by 2002:a05:6512:a89:b0:5a1:4712:376a with SMTP id 2adb3069b0e04-5aa594bac11mr306522e87.8.1780051510356; Fri, 29 May 2026 03:45:10 -0700 (PDT) Received: from localhost.localdomain ([94.158.61.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa5b071d25sm205269e87.18.2026.05.29.03.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:45:07 -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: isl29028: use devm_pm_runtime_enable() to fix probe error path Date: Fri, 29 May 2026 15:44:53 +0500 Message-Id: <184ef63b17643278dde6b9c15a9d6d1defd9d7c1.1780050609.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" isl29028_probe() calls pm_runtime_enable() before iio_device_register(). If= iio_device_register() fails, the probe returns directly without calling pm= _runtime_disable(), leaving the runtime PM enable_count unbalanced. On the = next probe attempt the kernel logs "Unbalanced pm_runtime_enable". Switch to devm_pm_runtime_enable() so the runtime PM state is unwound autom= atically on probe failure and on driver detach. Propagate its return value = with a direct return on error. With runtime PM now managed by devres, isl29028_remove() no longer needs to= call pm_runtime_disable() and pm_runtime_set_suspended() explicitly; drop = those two calls. The remaining isl29028_clear_configure_reg() write does no= t depend on the runtime PM state. Signed-off-by: Stepan Ionichev --- drivers/iio/light/isl29028.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c index 374bccad9119..4fb0262b214a 100644 --- a/drivers/iio/light/isl29028.c +++ b/drivers/iio/light/isl29028.c @@ -615,7 +615,9 @@ static int isl29028_probe(struct i2c_client *client) indio_dev->name =3D id->name; indio_dev->modes =3D INDIO_DIRECT_MODE; =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, ISL29028_POWER_OFF_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); @@ -638,9 +640,6 @@ static void isl29028_remove(struct i2c_client *client) =20 iio_device_unregister(indio_dev); =20 - pm_runtime_disable(&client->dev); - pm_runtime_set_suspended(&client->dev); - isl29028_clear_configure_reg(chip); } =20 --=20 2.43.0 From nobody Mon Jun 8 12:11:51 2026 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 A2D583CAE94 for ; Fri, 29 May 2026 10:45:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051517; cv=none; b=F733ddDQ/R+8RgtfnWuImrFwcC40WFm2V4jSCE8WcleA1wdogXNXiMr+7QqlXTRyTLv5qP+lYUuaLgXkSGV8n1mH2uCpd0SsOEpZBxWT04oTEUq0MezWz6mpy3OvIR29rNmZa8uu+uh5tcsT+y6GriD/G9E3Zswr7f+XaMarXzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051517; c=relaxed/simple; bh=v6N3OFP1Y/kL7gSI8Ozv1RZjj9iqSCTmKAuWK2R/IpA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pPMkSr9XXPKz4yhEUNWRVgCBqBwKG+GkFAmtHFNDB1GOEPQMcq0pny7itysnWm4CLQXaiKv3MimYrBQsrD2awohFJ2i1FyBjkA2QtoXnXqsWwnEr7zrnhcvHkAT6ttj3Q8oUKHXtigViMqAk0BHIwWtrmye/chq69+3vp6fZIYU= 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=ePEOctVh; arc=none smtp.client-ip=209.85.167.47 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="ePEOctVh" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5aa4a98cf0aso368483e87.0 for ; Fri, 29 May 2026 03:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780051514; x=1780656314; 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=ETzqxfvatOTulZdiDscTQ3AqA8L5AtJ3+8JSfJIcyQM=; b=ePEOctVhpvStyqPgxl6oI2G7TEmqFzSMZZTByGhflbDM+aDP8KKwb4u4OXPFxh9gtx ik4uByyH2BGQi/+AdVCx47IH0RHHoU6KUuqo7AwGvVivza9Xwb2uperLutjqvuF9Ztrt lwj6e34BKiMbJHc+hNEhYMDtGzU6e8e8YpT/CgNFA7craWCPn6+Z4CujfdUOekbgepHN a85jSNUYI8rSnMOXdWa6UP/h4o1Bvhe2hh+/mHZ73i7k9xZvyMj9gypOsgPbmR8z2lZg JhBm5FMjtxiU3gTE6c79PAxE1diXfZIB6yYte3BW+tKEjRKh93p8gytJCwGxLrn45l6C qvrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780051514; x=1780656314; 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=ETzqxfvatOTulZdiDscTQ3AqA8L5AtJ3+8JSfJIcyQM=; b=YRcF2J0EN71pWOuEC5MXNlPGBWaba5oesbhGXdH8jkF4Gzyim5bcmw3p7K/q+SlWPQ ZpGN85JieLpo0BTQWFJDZ22jMb6xsYAIkHAe7IXaLWn+IEH/8mzo9e8VZcfv9KplS62g no1AWlqn49NAWOC4EjbAQxKh6KZpk/AAfhsRCwu6WWlFlBZ+6v6zHXq3WrDrD7oODviU HIUnEuD59yzLUdXlxqk4u5ZHIHhKBJybFAv8Scj7V/72Jwl5vgAUzyk/zTGMMpke99/B U+fWCYaOGsqJEkDq+a/iUOPryHy4pD7ClaPd6PRA1NJ3/bu9eu+6B771ODB5Igk76Ceq CLCQ== X-Forwarded-Encrypted: i=1; AFNElJ+71LbVO5fPgplBl23HgvsdEEwmxo5cECbeOujKDpeIqVED8Ds+XSon6n6Wm4T+NZygqnXRRPtCXFR3Ox0=@vger.kernel.org X-Gm-Message-State: AOJu0YwkcHdoL72YWQW8TX1RTxmx/tFH68lzWVyMsERib2umqQ9uDJ9E dQiQNjnf3nZ9yvC0HrIBCuh+beKg9Dr4v8lMD4MUG76grlNo8N+s5Lq3 X-Gm-Gg: Acq92OFtjF8YvVLv1XaQ6bZ5czIhK5L0V6OVbU9MMRZMAgFtTEWOWuufKWGURzKL6Fv IUldsY7sMr8NBB60dWYuGAogOA1Itb55Lp0FEPXpLxgdVAiYjthGOdeSTNnNfiCTGUfy6w9UpfW OCA0QBhpi2fxIy9q67BB0vXi4ex8wwnaUfXzIJu72mELG7ntU5jkL5YTVmDJpTBnsAl0OehLo1Y tMBkEnAYSot8MkCTSpK6uaSOWsUCwolnX/pGmnLJwg2ItoUvVaMfvdHp+pcERcqo/0Skg5iFHB5 sx34aCRC41NehIfhC+qKIQxwmNa+QOyTY1ikwJaKyaeCTqNpelg9iD2X8dVO8pYV9U6I7igd/WG Fy6NKPbKKmEzJWyKE9z95z+ZUIJuN3lpB81RIICytfE4sF2Lmr7/HgmcuU3u3lckbXHP1bTuh7V Jko69Qkev4N+MXX/mYJhSq+pz4cL3kDVSPFnbHjes+LcP0lmgZCuK1IZw= X-Received: by 2002:a05:6512:3ca7:b0:5aa:2777:e0c5 with SMTP id 2adb3069b0e04-5aa5946c4e5mr319606e87.1.1780051513729; Fri, 29 May 2026 03:45:13 -0700 (PDT) Received: from localhost.localdomain ([94.158.61.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa5b071d25sm205269e87.18.2026.05.29.03.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:45:11 -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: tsl2583: use devm_pm_runtime_enable() to fix probe error path Date: Fri, 29 May 2026 15:44:54 +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" tsl2583_probe() calls pm_runtime_enable() and then invokes the non-devm iio= _device_register(). If iio_device_register() fails, the function returns wi= thout calling pm_runtime_disable(), so the runtime PM enable_count is leake= d. On rebind the kernel emits an "Unbalanced pm_runtime_enable" warning. Switch to devm_pm_runtime_enable() so that the runtime PM disable is tied t= o device lifetime and is also performed on probe error. The pm_runtime_set_= autosuspend_delay() and pm_runtime_use_autosuspend() calls do not need to b= e undone explicitly because both autosuspend bits are torn down together wi= th the runtime PM state at device release. With probe now using devres, drop the matching pm_runtime_disable() and pm_= runtime_set_suspended() calls from tsl2583_remove(). The remaining tsl2583_= set_power_state(TSL2583_CNTL_PWR_OFF) call only issues an i2c write and doe= s not depend on runtime PM being disabled, so its behaviour is unchanged. Signed-off-by: Stepan Ionichev --- drivers/iio/light/tsl2583.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c index 8801a491de77..62542d904b3b 100644 --- a/drivers/iio/light/tsl2583.c +++ b/drivers/iio/light/tsl2583.c @@ -846,7 +846,9 @@ static int tsl2583_probe(struct i2c_client *clientp) indio_dev->modes =3D INDIO_DIRECT_MODE; indio_dev->name =3D chip->client->name; =20 - pm_runtime_enable(&clientp->dev); + ret =3D devm_pm_runtime_enable(&clientp->dev); + if (ret) + return ret; pm_runtime_set_autosuspend_delay(&clientp->dev, TSL2583_POWER_OFF_DELAY_MS); pm_runtime_use_autosuspend(&clientp->dev); @@ -873,8 +875,6 @@ static void tsl2583_remove(struct i2c_client *client) =20 iio_device_unregister(indio_dev); =20 - pm_runtime_disable(&client->dev); - pm_runtime_set_suspended(&client->dev); =20 tsl2583_set_power_state(chip, TSL2583_CNTL_PWR_OFF); } --=20 2.43.0 From nobody Mon Jun 8 12:11:51 2026 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 18ECB3CB2E6 for ; Fri, 29 May 2026 10:45:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051520; cv=none; b=m2ZuP3WT9qMK000knAF2/gF0vvlYGGGdpq9/b+vUmiIF+qgLHz9X4EFICJt775k0jF06Rnl8OyXggZuigcBmzPv4kawwrP7iLf39p1u2GThVVMWJ+tQ0BdNIJfsd+QkRhQT7ihl2MuNV4p+V05gPgDWoufd424oL5Ls+eREW0KU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051520; c=relaxed/simple; bh=Qg+YOvOsxFa1FjF9pxlEVUZeNV4nkT+8W/V7DXn4Wx8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PWNJXkh7toGaXK9k0K5zHOyPPyECAA11fn6UJADa+mSFGRYZmqaqCc8AkuDrVjAsGnFZ6AOXPXcCg4hisUrt4H1SrD3tPUO4aPVj+p5I90539ItfECkT1UlLgK9QgQtf/sGLdmqwk/DfkIRdbijLJ/H6IfEtw4oIRXThkYDkT8I= 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=PEgahbHN; arc=none smtp.client-ip=209.85.167.42 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="PEgahbHN" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5a8c0c19195so1339741e87.0 for ; Fri, 29 May 2026 03:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780051517; x=1780656317; 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=v0MP+Ex7cIEzzP8tyMPl3ZCHPMlkjCOuy2uaX8dY4Hw=; b=PEgahbHNh7J1XKVUfIxVysV2gjwinqAcfr2YMwyaA4fESmsohXDxfqdmuFkO+Z9mMK jcaToBN0GISvJ4VZGz2dG3MTrPX/dCQvVVq2V95ixYtWQzV69+d849bUN+L4fAEidvci Fbj3EJT2iITYu6gkk5JDm2gn98NCGYsg/wIUX3bp+3rB1swMNqGpWO49MkTEvtMN0lK+ DgxNehjTkoTrwsrRGkCtuSbVnreKMwnno55x1JY3DAYU5wT8dR7jtD4Aar+watuvZup7 jfBCutlz3SJ3xlf9GZBc5St0biFxQoI0V90o3IXNevozKQRe3Ejlx3/MmLmPtd4NHl0k lhDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780051517; x=1780656317; 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=v0MP+Ex7cIEzzP8tyMPl3ZCHPMlkjCOuy2uaX8dY4Hw=; b=Ownn2aK4Z6WgYhdils/m87/MipPuUApA0RzhSfi9MweZ2RX+j599lhOkC+w7ogbN7i XdBJaDGuNwIr8tasPBeggEGPLbMZ/W3Lh0JQFRElOPxWC8SwIvSOcilEDZ4BYnmWQoKY Hl5u48717dq738l2YEfPwI4HmM+72XFRatkozUeS6HRm0l4uwFnQiTb8iA3/pAqJbh+r evngYSWmlyNbzS+15zLRhj64psiyzmpjdOrDypflAnn6PL1QOEWZMDGroofiIO1N1wwK 0JBrIX+K8aguqWouC0qsMJotrfoAHbewYwRv5PnRGqnaZLo/GVy/BZ9gnCP+9avjhznK ghVQ== X-Forwarded-Encrypted: i=1; AFNElJ9YXTwqJmH/4Tz6iaXudR+V69iDfDyzHHJcUi9CPWSMEww4aZ+T4E+r7kmbtERUzYgzLmXNhkJ77gY8ij8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz72xRAqbOF9LbXkXEtxjDuGqAsY4fysA9/yoIqzHQDd44IMreb BX/Z9CK5kSbuqpQLxlfAH+ODPTzsdYiQtPWNzlOt3AsKA8AEd+e5t6eS X-Gm-Gg: Acq92OHrb8UflBL+is7dF+8op2itgar4WlBMH8XTEKUOCSubf0AXM3vODqI2QkSUB5X 4lNM8wzThapcWxOhzsqupBBeBfhHV83Xwym7uxO51LxF48hcUBwIV3CVk9jxy4PEpiBjqxoH2/C jSU/jP7BeEPK0RZZPF75fpLQIpOkCVFXG/+x0GHjPTYdmWWudPwxChQT7inih/8PhyfXob/rWR/ NlEoiNI5WBtaSpkiqDQkzDU9LK4SDVaZK87fJZEU5StoKrYuq5AT6Gpeni9/woyiIuSuC60nl22 ox9sP67iihkqDrF5jG6XXrhbiq40OwHUamSTvEldxA448lSJdjCTERvNr1BN76PRxleyv480CjZ R4XPX3UxeSjXTd2eOJb2aPUQxVYmLeUc0OswJwHQ1yVDMsByH4k2Cmx+WdlzXytJOJReKfX4jTg azkdkVRmLbSdkp6tiudBE6OaJIaNI4v6fi3UZ6eOmR5P6AzVklkBN5pHY= X-Received: by 2002:a05:6512:1304:b0:5a4:f0:c4c4 with SMTP id 2adb3069b0e04-5aa594c1db9mr260623e87.7.1780051517040; Fri, 29 May 2026 03:45:17 -0700 (PDT) Received: from localhost.localdomain ([94.158.61.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa5b071d25sm205269e87.18.2026.05.29.03.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:45:14 -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: temperature: mlx90614: use devm_pm_runtime_enable() to fix probe error path Date: Fri, 29 May 2026 15:44:55 +0500 Message-Id: <983359a9d0ebdad84f47a8ea95301a9626bf5abd.1780050609.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" When data->wakeup_gpio is present, mlx90614_probe() enables runtime PM with= pm_runtime_enable() and then calls the non-devm iio_device_register(). If = iio_device_register() fails, probe returns without calling pm_runtime_disab= le(), leaving the runtime PM enable_count unbalanced. On a subsequent bind = attempt the core complains with "Unbalanced pm_runtime_enable". Switch to devm_pm_runtime_enable() so the framework disables runtime PM aut= omatically when the device is unbound or when probe fails after this point.= The corresponding pm_runtime_disable() and pm_runtime_set_suspended() call= s in mlx90614_remove() become redundant and are removed; the existing pm_ru= ntime_status_suspended() check and mlx90614_sleep() call are preserved so t= he part is still put to sleep on unbind when it was not already runtime-sus= pended. The edits stay inside the existing if (data->wakeup_gpio) branches, so devi= ces without a wakeup GPIO are unaffected. Signed-off-by: Stepan Ionichev --- drivers/iio/temperature/mlx90614.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/m= lx90614.c index 1ad21b73e1b4..9e09597a1c31 100644 --- a/drivers/iio/temperature/mlx90614.c +++ b/drivers/iio/temperature/mlx90614.c @@ -625,7 +625,9 @@ static int mlx90614_probe(struct i2c_client *client) MLX90614_AUTOSLEEP_DELAY); pm_runtime_use_autosuspend(&client->dev); pm_runtime_set_active(&client->dev); - pm_runtime_enable(&client->dev); + ret =3D devm_pm_runtime_enable(&client->dev); + if (ret) + return ret; } =20 return iio_device_register(indio_dev); @@ -639,10 +641,8 @@ static void mlx90614_remove(struct i2c_client *client) iio_device_unregister(indio_dev); =20 if (data->wakeup_gpio) { - pm_runtime_disable(&client->dev); if (!pm_runtime_status_suspended(&client->dev)) mlx90614_sleep(data); - pm_runtime_set_suspended(&client->dev); } } =20 --=20 2.43.0 From nobody Mon Jun 8 12:11:51 2026 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 A93143CCFA8 for ; Fri, 29 May 2026 10:45:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051523; cv=none; b=pjri8tOVACO8VSigIayaL6IoUahjEh7ZrIS8BWx3TjosIfOqmQrY34xnERWyLLbzu8qUWRw58+YDpMNiyTU6CJIqHT5PHz65V6UWmkQntFxm79JF7z5LsTYjLZT3ro17HanIUGXZtnKD141bHhcT7w+XvcTg6Nz5zJmkZSxUX4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780051523; c=relaxed/simple; bh=FqBG1uSwhCIFSXKTiWQI1z3GWzWpo6s5egdT0gjQQjI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Yebi9HL4oDg3f14vo878qOPyhe/Kbp46p0BmQZ5vPs5/+xs24m99aLboHcD7jFfLJO2Nc93ySTn/Fg4OEeXtFp/kLOH0GPSZWsR/liAV70MV6/ME7nx53p/fvc1UJUOKQXg7ULj2rtzdnPIBehQ9vVMhKfZ4FvUPMBoeDVI+WO4= 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=FKSmFiR8; arc=none smtp.client-ip=209.85.167.42 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="FKSmFiR8" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5a875ca312eso1432722e87.3 for ; Fri, 29 May 2026 03:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780051520; x=1780656320; 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=AU1BToDPYq1VyvVsi3Mxkvs2hOYoBg+fWm8ow1e5Ta0=; b=FKSmFiR8M1v1Wyu3tK3fCldb3aJEEiaF6K8ecx9wNL8Z0L8+sxn6sQ+/NRDTzzPmuA GeOVl5ROPfglTHVuniHL8KIx7YqgbpPyHFfSLIEyJ2iPyun+8y94l1xRt9yDI//g0igi j8QAjx9dTAJibNGcL5rWf9J8s+/mTX9rItABimt2sgN8+nWp3XroqXsh8PZzRURBBSmy vA0efgO3FONj1pCe8ukffMezhpeQ26G/8ZYdNvOZ9QHr7B/QoHW69kVyrwvnWu+ZT7lE guh8G4O+oUkEfH6iRA7MJtfB2VC/9Z+b8xNEcWo9ljAfigu+X42+nNRfkwoB14ei6QmS aEMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780051520; x=1780656320; 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=AU1BToDPYq1VyvVsi3Mxkvs2hOYoBg+fWm8ow1e5Ta0=; b=lImqN6ujmLKJp3B+EpgIbTwA7KPYJ6+Xk0lPF1vhBboedPY9jWKoisSJTGLVGRc2h2 I8EMnMCID/AWhAUbbu0bYW22MwLPmHJ2X9c7ADqVuhbAAPQ7dCq/+twZb1zP4wLYARQ+ QHxyFdDyaX1/6QB/d9JrJ91/7bwtMBdYisFWhw42wb8AIpHma3Qb9Mj8gwIQLkMi/rTW sl2ip8ZuVU/6kW1VBqUnXJKBOe2IRf00PIFBEHUjzUzmGe4owQ+grSB4+uYEPHUFwa+h YAq/1MLwSxl9bwi883EqsQkJctFpzMoFpt7N4ktL04gHid3uDy4Fs/TfxL0+zXhKrsKE VSMQ== X-Forwarded-Encrypted: i=1; AFNElJ8d98tAfwbRWzzg/FozrWzDG2Qir6gqMAJnU4OCSM3Eret64qb5gNOYob/+g2IEC9lsPCth1D27+WiQaqk=@vger.kernel.org X-Gm-Message-State: AOJu0YyFUzrpCcxWVw5o5JJfQOQpYJvW/baIVx61F/smLLNTLXxugr6u LVM69cBkJblDU24lOoJljj8rzrXYzHw3U2B1ZuTJI417R4OwYDwtKWQHSm6VOKxP X-Gm-Gg: Acq92OG933kzoopLieNbREpLQSpC3khGCDHuq1+Dbf+t8kpN95//9ZVFJ4JsPTcxDfP kpWVpWeLTC7rzw9PJP9oW1fEKo6E283tVdtIYX6Z2mtE27lnUjfHG+TD/pTykxvj/43cpHjpOb0 Gc9oQzHKsnlxLlp/xfRr4PpCpR7uY9nSzlbXtXC8uSzWjB+EBUkAIOYWQVB9eqvvJFAExSq1JBh M2AP0wpdEaFm1jA/uVGhOIRRqq4XXrOkyR5dDTGvRVPiov3nz04Kc6tQbF/ixYgtlTEb4RvzGHk U+1v8GvxoejD9rLR9ailupjQQRkvGBhgkiXmDehqq9zzB7qf3xKxAdpwJjjOM6UvEZ8ZG4J7ugx 1whSSSlHtDE1gcnse38lMrPMcrsfNsrZSBCg1VRrvocUn7U9VK73W4gY+RSlaU4VQcPg0bh7Fra ol2QgJGeSyN53wFWKhzCCaV7+1/YrVZPoUroI4dPh9mudNdSZC9ehe4c8= X-Received: by 2002:a05:6512:2210:b0:5a8:bd9c:a2e1 with SMTP id 2adb3069b0e04-5aa594652cfmr310683e87.2.1780051519854; Fri, 29 May 2026 03:45:19 -0700 (PDT) Received: from localhost.localdomain ([94.158.61.193]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa5b071d25sm205269e87.18.2026.05.29.03.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:45:18 -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: bmi088-accel: use devm_pm_runtime_enable() to fix probe error path Date: Fri, 29 May 2026 15:44:56 +0500 Message-Id: <81bee2d03a2a915c0837f61e407856db80aa98b9.1780050609.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" The probe path calls pm_runtime_enable() and then registers the IIO device = with iio_device_register(). If registration fails, the function returns th= e error directly without calling pm_runtime_disable(), leaving the runtime = PM enable_count unbalanced. On the next bind attempt the core warns with "= Unbalanced pm_runtime_enable". Switch to devm_pm_runtime_enable() so the enable is automatically undone wh= en the device is unbound, regardless of whether the rest of probe (or the b= us remove callback) succeeds. This makes the error path correct without ad= ding a new goto label. With the runtime PM teardown now handled by the devm action, the manual pm_= runtime_disable() and pm_runtime_set_suspended() calls in bmi088_accel_core= _remove() become redundant and are dropped. The hardware-level power_down(= ) call is kept so the chip is placed in suspend mode before the regmap goes= away. Signed-off-by: Stepan Ionichev --- drivers/iio/accel/bmi088-accel-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/accel/bmi088-accel-core.c b/drivers/iio/accel/bmi0= 88-accel-core.c index c7da90af0d2d..0fd840d85a15 100644 --- a/drivers/iio/accel/bmi088-accel-core.c +++ b/drivers/iio/accel/bmi088-accel-core.c @@ -573,7 +573,9 @@ int bmi088_accel_core_probe(struct device *dev, struct = regmap *regmap, /* Enable runtime PM */ pm_runtime_get_noresume(dev); pm_runtime_set_suspended(dev); - pm_runtime_enable(dev); + ret =3D devm_pm_runtime_enable(dev); + if (ret) + return ret; /* We need ~6ms to startup, so set the delay to 6 seconds */ pm_runtime_set_autosuspend_delay(dev, 6000); pm_runtime_use_autosuspend(dev); @@ -595,8 +597,6 @@ void bmi088_accel_core_remove(struct device *dev) =20 iio_device_unregister(indio_dev); =20 - pm_runtime_disable(dev); - pm_runtime_set_suspended(dev); bmi088_accel_power_down(data); } EXPORT_SYMBOL_NS_GPL(bmi088_accel_core_remove, "IIO_BMI088"); --=20 2.43.0