From mboxrd@z Thu Jan 1 00:00:00 1970 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: 8bit 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_disable(), 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 automatically when the device is unbound or when probe fails after this point. The corresponding pm_runtime_disable() and pm_runtime_set_suspended() calls in mlx90614_remove() become redundant and are removed; the existing pm_runtime_status_suspended() check and mlx90614_sleep() call are preserved so the part is still put to sleep on unbind when it was not already runtime-suspended. The edits stay inside the existing if (data->wakeup_gpio) branches, so devices 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/mlx90614.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 = devm_pm_runtime_enable(&client->dev); + if (ret) + return ret; } return iio_device_register(indio_dev); @@ -639,10 +641,8 @@ static void mlx90614_remove(struct i2c_client *client) iio_device_unregister(indio_dev); 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); } } -- 2.43.0