From nobody Tue Sep 29 12:02:20 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 B0D472DF13F for ; Fri, 7 Aug 2026 14:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786112399; cv=none; b=Zbq4ysMfJo+51kxkoW7nZ3gu2h32ayl4+v2w2EHo+7ovOesNkzac9oau00uk04wj4n3dgaBkohIUQuEEOQz9LqJ+K5IEkh1Z2kd7cXXltsvwQwKtsN8NktH5UUUBVwyvYe5w2mn4PhgRvD0YimRPy+V9ItVEndyV4zBBU/G/N/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786112399; c=relaxed/simple; bh=9xZaUz+b+BWl6IcZCMMqXWOA7QSl29Gyoda6a9Jb6qc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=g5mm2DdJvmO5MCTpk4VdL8I6XItuwm262HOS1CrLKfmagrO3dpSMqQiXS8A8SYNX1ku+rl4RswJc7oJU9gYMR76lQFXmWM/U5gwdF3YeuCYHCDKUj01fOetuCbmopOOm3pybipT7nXXHfDQsld/kM7mk0gKDahqWu8+sUmK9DIA= 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=gsVOO7Zq; arc=none smtp.client-ip=209.85.214.180 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="gsVOO7Zq" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2ceaf8a1265so50070115ad.2 for ; Fri, 07 Aug 2026 07:19:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786112396; x=1786717196; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=fg6k+823sa8zpOs3kR6BQUK6YT6riyT8/cMRVnCyQtE=; b=gsVOO7Zqj1JRa3Pi/b3S6A2PDb184FGx1OOuJn2nqUFm7ywJsBCA0Dt4i2O4HE761D RyCVfKhiJSc6x2udi7AH9RgeXnigiaY872oPZJtz0rk7iwC6lims2yrxs4y6sLIGShz2 QBH5W4My+UGV/AwRmzDc99GfEKIXRwexLdpf8+wuwkAPrf2lfl2lU6vgaiS4iZzo8yg4 0XEZE7Yq0wjRJE4Y+hYzvDACqHceqoQ8g95snYmTHuWwBq8meM5JmFkQgv5XsyzzNLW6 K9tI/Z5ipTCBzpxwQdiiKH23cvRo0s4mXo9LYFbu1pdvhrHFp0gW1QJW1AeeKR4ZsAYI Or5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786112396; x=1786717196; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fg6k+823sa8zpOs3kR6BQUK6YT6riyT8/cMRVnCyQtE=; b=Dt4FS06I4j0aPRzxUH8woKFLX5xxZforsaxpkB+xYsZEV+LWSbAlDQBbScBs7qcD3g KHD2UJaoTm7zlhW6QXoQjNYRzcpqfq0Ik4jZT554U6sMpBHNLrwW4d/taBTCoGPlaxab GCwWxvp/do8sVD/RDQVSUFkqe7zte1rrD9cEZmBQY2OB4AgDD5+Sc7yY8UvpvFu+JSkg CFLjtg9z3dKqRG1nXg2PLMED1vMWIR68GQKgAwn1UTxD/NnTiAltTAp4FJIXtDLLRW1n nh3O1O6HJ3kAMK7n2WAJ39Id+wxv84peeY1+vyg6mHYZdGsRJcBVDKy3VUAIocpSIm0s jpjQ== X-Forwarded-Encrypted: i=1; AHgh+Ro/+9NkLEwTgeNsMZSCz4PeXXQ9fv/+W2xxo4NEdX21/XwmJQ7wfgid9pJ0550joE3DztyzV+VrvThRKOw=@vger.kernel.org X-Gm-Message-State: AOJu0Yzb6UftkxrCCJUJ+JHEyr3XYmCzUsPNfNUjvCUa/oUtkGrEWem2 Ez/X+xpDNqyf+0EScZV9zUXp1PJy6BCwCLfK3uvxASsFiiK3E/nqe5VC X-Gm-Gg: AR+sD13IJi0SjwproEN0u8vPCT1nPldxN+Fltjl+Rw4RTQJ8NG/PoPfWs4uWaDpJ5WK zNOeFaX8lqIwVTOxJ27Eq2yjFMquwBcoG068nTDF/yAzPYi4ePWUcotCCF/8w0hA+JY5qtRqkDR mN1jxvXX1L3HmdMCdpqDUG7/Hb3Kxm2qdZ/jQNUiNpEoQBA3JU4edXS0k3thLCX56opRUU2kTBw 6Ajq53sQjVa/aKcUaepn/KQr9Iwt/lOOzeqDNxhfgjDR+oHmFLcQXEBQ+5Qkry+C/ALXpR+LNCT ow/gcSYBEu2yfYAabR7p3tkvSX4qSac76raL2/OjfxQtfhyBssFG/0u8mLaudaWTwfvkEBK9bFK yDqwSEpXMghDuVKL6JDCrhsbaFZhTKcq0MKS6gdyqUNj38733r7JnHFPxwn2nS8zsF2jzo5iHky JhsXscpG1PXIboAPw9EsEdwh8o/4tsK/38Bb2cnybCqfFEdmTbm9z6kLIYaw== X-Received: by 2002:a17:902:dac1:b0:2c0:e5ee:f554 with SMTP id d9443c01a7336-2d0ca71b3d7mr260043035ad.8.1786112395789; Fri, 07 Aug 2026 07:19:55 -0700 (PDT) Received: from lgs.. ([101.76.249.46]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d14ccac104sm10196345ad.10.2026.08.07.07.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 07:19:55 -0700 (PDT) From: Guangshuo Li To: Andreas Klinger , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Guangshuo Li Subject: [PATCH] iio: proximity: srf04: fix runtime PM autosuspend cleanup Date: Fri, 7 Aug 2026 22:19:37 +0800 Message-ID: <20260807141938.2491195-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 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" srf04_probe() calls pm_runtime_use_autosuspend() when the optional power GPIO is present, but srf04_remove() does not call the matching pm_runtime_dont_use_autosuspend() before disabling runtime PM. The runtime PM documentation requires pm_runtime_use_autosuspend() to be balanced with pm_runtime_dont_use_autosuspend() when the driver is removed. Failing to do so can leave the autosuspend usage state unbalanced and may result in a usage_count leak when the autosuspend delay is negative. Add the missing pm_runtime_dont_use_autosuspend() call in the remove path before disabling runtime PM. This issue was found by manual code inspection. Fixes: 2251157b335b4 ("iio: srf04: add power management feature") Signed-off-by: Guangshuo Li Reviewed-by: Joshua Crofts --- drivers/iio/proximity/srf04.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c index 7be50bdebfcb..5f270f506803 100644 --- a/drivers/iio/proximity/srf04.c +++ b/drivers/iio/proximity/srf04.c @@ -347,6 +347,7 @@ static void srf04_remove(struct platform_device *pdev) iio_device_unregister(indio_dev); =20 if (data->gpiod_power) { + pm_runtime_dont_use_autosuspend(data->dev); pm_runtime_disable(data->dev); pm_runtime_set_suspended(data->dev); } --=20 2.43.0