From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 9E48622E3F0 for ; Sat, 1 Aug 2026 08:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785574113; cv=none; b=NtMa47A6qlSkG8fkIlwSe54CNQjdwVKXlCHUHAi3rDzp8GW2Plpi4c2Uib02Y1EyG6MuG8kUBcjwg+weXemU4vbkRVHEc05bk9lZwOo18bzyuCj2jUIuX810xYvo9FN0lukQwuzVAi8ud2eJP0R/s9Y0V61++XZf3/11ZAbhhD8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785574113; c=relaxed/simple; bh=CBTuGAaSO+Mj6Xd9zM2Dy/TQHDvuh1uTIenUQEv3ye8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OcM2HroA9vJz17bXyxYwWCPfdkvja3OjQLitNkztQoMDeu9t79pH2nHgdeJx72SYq8YCgt6BBpVL5xxm58/p7SKvcWGEYd8IZshgeJVG3RJEsV47EL0oceVk5xc1TYidH4ysi9yqhlRGet6wIDTMTHj9jxL1FRM403BzBe+GbQA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tweaklogic.com; spf=pass smtp.mailfrom=tweaklogic.com; dkim=pass (2048-bit key) header.d=tweaklogic.com header.i=@tweaklogic.com header.b=hntZ1oT8; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tweaklogic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tweaklogic.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tweaklogic.com header.i=@tweaklogic.com header.b="hntZ1oT8" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2cf50c6f235so20344735ad.0 for ; Sat, 01 Aug 2026 01:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tweaklogic.com; s=google; t=1785574111; x=1786178911; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=/pZ8m7pRzCz8D91oW/VyFl59Ql2se0V6HINSg9JYJs8=; b=hntZ1oT876WG+B50DD6Rfv1ytRErqAhdgAnwdGLjMZ1sq93p0V+YL9yfjIcFeiEW3D nUy2TiFOhB0yr+nDi+Aoyyu2Egnbql+BegP4n51OfWJl0juTPtg6v0R2EDPrY5oN3ENQ Jno2zrBps7HIAuJfA+aTEg6pUwDHyK4JDp840Dv0BkDj+6ul4e9eB30ydxLdsD373jgu xqlX4ET3UmUrfF/6DpPh8HSgJzVw/Rd99TOfyptCeTyq9DYMXxVEXcwqDfLdcTKsJKPl siEZWlrCbJ6UZo6mdRzqoOtc/8t97l5q8IrJZhtbQTpf2ESXnG6enPCuYNmjB3Yt0imA mOqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785574111; x=1786178911; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/pZ8m7pRzCz8D91oW/VyFl59Ql2se0V6HINSg9JYJs8=; b=RWxFt5yzHOxfwvoorv9LkuyYUTJxEEJGLA3Mg05at0AImNAG5xh6tBP2/DnX8nWsmF LsCHot6D/Eh8XJRg3vMy5IfM7ARN6NLvZT5J/lK4l04dGtOGMDHbnQdaJFHFcxERCTRl Feh6sq2biPmO8muxFns0JRPcIngjoFCGhQ2dQlMMnPXPnqoSiFXU+8M0Z4jkSokIP292 zv8J1/7VLkDqcMAQqgfmYvqUdm/yyCmH1uPJc2lZz+g4/34rsGT0zAyg0LPCnJQpz+W4 94gdOTP7sJPmxu/+6ppXhPaBeo7NgETHijB/a6YX/F/44XzorcfWF2fUvTySMUI2O4Ie sWpw== X-Forwarded-Encrypted: i=1; AHgh+Roeq3K017DfVoIm6cZswU53L0IseF6KamRiaLe5N70H1CPkbl2JbTsuddvxtimqYbUMC4nnprHdhb9/u7U=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9jEu0OIgiEZ846Lb5wv9zgBllXu13XmxZp6las1vupY2fFYgs NLcT530ukin4jK962mBGRy+Grlpuc2JSgFEbaKw9GuedzMm6EFlD+LrXvKNVpoWSJi8AyD+I7on VtJ5rzgM= X-Gm-Gg: AR+sD1322DenjGHFXYJeO9nZBbZGbdir8TVpysC8eMREbT+B55Tpw1OrjGZ3IMp3Wqm BTsAI8uIleeqyKSBzdJ9yHvnQvHIYPxmb04OgopbwKnS1E8IMtqCvOojVGewdu/lf26M7rrpIP+ oJkZCpCe7sATq4+A7IHQ/kMbT9PmXFiCCLiDphoOdp+8Gt5iopTzmM9RHyZZTN1NUMDiEjPichS tCjb4rFZVybsUrou8MP860Ipk7LdZ7nhwYtLywmXFI4/TdfvyG7sfquSLqVenkofhZKeB8T5uh7 Kajvs+aA1RsaDm/Qttf+qrD2Lv5av8LnpB7nbcMqquQ7k9rUKgP6zh2PDXLubvqv+TOsEHaZKDN xM4lCO+imzS0+4LkL5PPKra1Wq/5XbnKAi16NNda9I5fCm8+JLpogbggPjBQCO3UqEcZFQEL/oZ cGNCeDYiqEBVyHLRyuVTif7OR0qFVmGCMiBvDnS9HYvfic2WiTmig4euT9Jj1enJz0vkkmUlhj/ HZ4sA== X-Received: by 2002:a17:902:f541:b0:2ca:5970:732d with SMTP id d9443c01a7336-2d0524810e8mr29279355ad.41.1785574110963; Sat, 01 Aug 2026 01:48:30 -0700 (PDT) Received: from [10.104.119.12] ([129.127.204.12]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d04b0eb598sm15724405ad.51.2026.08.01.01.48.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 01 Aug 2026 01:48:30 -0700 (PDT) Message-ID: <166588b4-7bd6-400e-9be3-300dd1a1f9f6@tweaklogic.com> Date: Sat, 1 Aug 2026 18:23:19 +0930 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] iio: light: apds9306: fix PM reference leak in apds9306_read_data() To: Jonathan Cameron , Moksh Panicker Cc: dlechner@baylibre.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, skhan@linuxfoundation.org References: <20260725051048.5616-1-mokshpanicker.7@gmail.com> <20260727033151.0ea0cb9d@jic23-huawei> Content-Language: en-US From: Subhajit Ghosh In-Reply-To: <20260727033151.0ea0cb9d@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 27/7/26 12:01 pm, Jonathan Cameron wrote: > On Sat, 25 Jul 2026 05:10:48 +0000 > Moksh Panicker wrote: > >> apds9306_read_data() calls pm_runtime_resume_and_get() but several >> error paths return directly without calling pm_runtime_put_autosuspend(), >> leaking the runtime PM reference and preventing the device from >> autosuspending. >> >> Add a goto label before pm_runtime_put_autosuspend() and use it on >> all error paths after a successful pm_runtime_resume_and_get(). >> >> Fixes: 620d1e6c7a3f ("iio: light: Add support for APDS9306 Light Sensor") >> Cc: stable@vger.kernel.org >> Signed-off-by: Moksh Panicker > Good find. > Please look at PM_RUNTIME_ACQUIRE_AUTOSUSPEND() and matching ERR macro. > > Using that should simplify this fix quite a bit and generally give us nicer code. Nice. Ditto. I have to read about it too. Thanks Jonathan.