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 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: 8bit The probe path calls pm_runtime_enable() and then registers the IIO device with iio_device_register(). If registration fails, the function returns the 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 when the device is unbound, regardless of whether the rest of probe (or the bus remove callback) succeeds. This makes the error path correct without adding 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/bmi088-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 = 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) iio_device_unregister(indio_dev); - pm_runtime_disable(dev); - pm_runtime_set_suspended(dev); bmi088_accel_power_down(data); } EXPORT_SYMBOL_NS_GPL(bmi088_accel_core_remove, "IIO_BMI088"); -- 2.43.0