From nobody Mon Jun 8 07:24:45 2026 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 82D382264A7 for ; Wed, 3 Jun 2026 12:19:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780489177; cv=none; b=u07e3VV7hmBb8PXoGcHKsbytJQ+FRa5OybNothVUx6se/cbMGU4ovTOPPzcV28/GqPO/Zy+FobYGLaPmtYwQtwpOK58h7iRcrn7zLnorMfmxFNzUOI/5D+84sMSiWUnuaUeJ1Kq2xTenlDQ2CB59sm62DcBjitcaG0fW5gCLmbY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780489177; c=relaxed/simple; bh=Yt/JxUce6IhMqUO9FwATbcqq02Llm7nzcJqjRKevsQE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Q5yklRpJgYOoi3OGGnY1+lSgVO0PpS60yTdxmMqxJd04TFAMe/qfu72zYdOR+/IK+hjK3V6fCN1n/yFMvs3UPivJMAFN9hY4Bij7XFISEmd0ceJsxkkQwn3fPX1Z7wVsQmSZ/GnOlyprj02P2/Nw2E7ksO9ToQKQTtjfoMZdo+Q= 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=TkUtqRZk; arc=none smtp.client-ip=209.85.215.170 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="TkUtqRZk" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-c8589498839so1852038a12.2 for ; Wed, 03 Jun 2026 05:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780489176; x=1781093976; 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; bh=pFoR23DydmSAorwZ58Hs6gBKs13ppUFc8z8JdA9tJm4=; b=TkUtqRZk/BsilHu5JEfC8CKcsVTkv1zLCSWS/r4knGpYFQ0i3qmd0mV/Cji40AuHVL cKKQoUE2jgMa6frG/Gb7v8LLZFHOzHZFZ5qNP0wSrOoCO03BR3K2bKovDaCyw8LFfPYq 1YaA5cmSGhEecS+6NCkB/c6ZJW4vi/YtfJnbNOv9HOOWGxjTN/7Sfz7Se9jJX1C/e9jz P0Q4rlbi8sS/0dncrWCoWNQBS4huFnY5zyd4vctBTfWWkE347AdbmpUXyhJePflZz3eK kzAn/7QaxzjxS9KWbrjjfD3P79i0W2o7KcBXgrcV9uBAF3TU7MH5368fhgadwmJ3VQ+2 Q2/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780489176; x=1781093976; 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; bh=pFoR23DydmSAorwZ58Hs6gBKs13ppUFc8z8JdA9tJm4=; b=WWNa7aRPLmhMHYE2NChC25x8IzvpxhftiDlcj4ntr8GdgrIf4BTlG0F5RQ/lzsK2PU Jt0oj3EF3FnIx/ZEt/cY5ejJBuvDuc5lo3TDaxvNH8yioxFKYk0TevRpIHpOxJFGO1+W 5TpA5M6W5O4ztji5TzZautUJzknhHlf/gXMiR/rTSErtEFri8VEnqiOoaSGq2IYLcGer bS96+/0g/T78K8UIupvoUpFePOpdAz61OgYeiJoS+ziouSbNC/HHTdew/DpN7FfHbLYw 4do+DATFnXq0iZSgbjQiMhK3FIsRDzXixnWf4h0PppE4SSt8am1gbbShQ+8PY3jJTDXJ Z8TA== X-Forwarded-Encrypted: i=1; AFNElJ9JuDHoNlSXpyylDe8uc9l1Us01n8yqTUvcAyznMJ3EM3fRLLmBoqdh0xTu1KAkCC43mS62E9eKQKd6j04=@vger.kernel.org X-Gm-Message-State: AOJu0YzsLp2Jf448tfmBBjJtyankH0iKlbZQo6K1ftvJ0BOisv8X4oW8 X3fTNv/MVWOgYzGyuq2EaWBkgrocHbey8jeb3hvzHxyc+/ZMqBxilFUT X-Gm-Gg: Acq92OF/CTZyHqVsyOQnZG+z9C++fCZJYKsV5drkWOBW1ci72xHIlF36Q5MQDmJUQ2+ K2FLc/KM9GzBtbX9SAMd+ybOuUDIMj4GBCxeTNBSd4qLSHy0l94u9EvO9uZAFASzVg4bkkejbtO RyAPH7Bq3blgzptxGpFDegkLfsmrCdDjuE2koIObgudkA057cyYMdZ7G12AsHWGwD13DCB+8bSr jt2HF/8xT+venaTrwxDwbClGYu/PunOi6IoamQxOfLLlEJuPZxVu/29DiSRiqDar1TG3CMQCLh4 TS1D8jTBnwtfspok++2PjQnPX9U158esWUde2tDyQ23e8T663AdFnscAjxiYPPUFW4Zib559wJL V7HQo4cbGRkP81IJkj6ZU5eF6XlKS2qHxjgsO194aE5P3kxb5sOoreSJz77EjXyJsFSl+YFcHR0 3CCIcDUggA0BnlcJgL X-Received: by 2002:a05:6a20:7289:b0:3b4:6af6:faa3 with SMTP id adf61e73a8af0-3b49748e7bdmr3401962637.10.1780489175782; Wed, 03 Jun 2026 05:19:35 -0700 (PDT) Received: from lgs.. ([2001:250:5800:1000::f280]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84282375f2dsm3150698b3a.19.2026.06.03.05.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 05:19:35 -0700 (PDT) From: Guangshuo Li To: Francesco Dolcini , =?UTF-8?q?Jo=C3=A3o=20Paulo=20Gon=C3=A7alves?= , 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: adc: ti-ads1119: fix PM reference leak in buffer preenable Date: Wed, 3 Jun 2026 20:16:40 +0800 Message-ID: <20260603121640.1394763-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" ads1119_triggered_buffer_preenable() resumes the device with pm_runtime_resume_and_get() before starting a conversion. If i2c_smbus_write_byte() fails, the function returns the error directly and leaves the runtime PM usage counter elevated. The matching postdisable callback is not called when preenable fails, so the reference is leaked and the device may remain runtime-active indefinitely. Store the I2C transfer result in ret and drop the runtime PM reference on failure before returning the error. Fixes: a9306887eba41 ("iio: adc: ti-ads1119: Add driver") Signed-off-by: Guangshuo Li --- drivers/iio/adc/ti-ads1119.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads1119.c b/drivers/iio/adc/ti-ads1119.c index 79be71b4de96..9324408cb3b0 100644 --- a/drivers/iio/adc/ti-ads1119.c +++ b/drivers/iio/adc/ti-ads1119.c @@ -459,7 +459,11 @@ static int ads1119_triggered_buffer_preenable(struct i= io_dev *indio_dev) if (ret) return ret; =20 - return i2c_smbus_write_byte(st->client, ADS1119_CMD_START_SYNC); + ret =3D i2c_smbus_write_byte(st->client, ADS1119_CMD_START_SYNC); + if (ret) + pm_runtime_put_autosuspend(dev); + + return ret; } =20 static int ads1119_triggered_buffer_postdisable(struct iio_dev *indio_dev) --=20 2.43.0