From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 825C8513551; Wed, 30 Sep 2026 17:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789429; cv=none; b=A7ltC0EnCRGAXVUTHWNn0aIxjjRhidCu1HIxHQLKUHVcZWiKp49IWgJ8Zvmamc6DXdU7r4Q1/8slDV55kv08E1xsxa3PpzI/wLDZxulDqGxzGTl3tUBgSMSxrd5DbjAX2AlIx/S1r8RSQ1WEGrq8uuFC2lxe235acksUmWW9WyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789429; c=relaxed/simple; bh=DUEwx2qZMId8tuolzEF9m3CJF1kduPq1E0BIS72S8/g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PMEOTViyJn/FosipLRTddk9Oo3ZirTehjKqUnv5b7TojyvcNdROYBw9A8vIVpaTJw0aGxPM3ZtQRQrQ3ve0k/eOr1GGpcb2+CH4qCqWdOEKTd3mnndrZpCp9gyJbanaTx3Hc2ywfkDkhQ845cdGIdCTvwqW0SQf0teR4rKmDRQQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ml4ZAN3R; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ml4ZAN3R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D35DB1F00898; Wed, 30 Sep 2026 17:30:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790789428; bh=K0BIKa8KIgAGaCbNH8S+g7d3J8Q6/SczKa9buPx3TAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ml4ZAN3R0x+LwFk6VrRa2XzO25ZdPg854OUPIO8hn5M+gqw1WyR2jHRTuD8eqPzFp y/9C1RT/+nz0feK+79SuLZibVwD5ujhOobBXKZqR1ys+hZVmeJSggE5GAbNE8221S0 7KDq1qa0TqvAFGbCwEocxePABtrm8Z9Kmaq2+fTo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wentao Liang , Charles Keepax , Bartosz Golaszewski Subject: [PATCH 6.12 474/877] gpio: arizona: Fix runtime PM leak in arizona_gpio_direction_out() Date: Wed, 30 Sep 2026 17:23:05 +0200 Message-ID: <20260930152424.901669585@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152414.738996857@linuxfoundation.org> References: <20260930152414.738996857@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wentao Liang commit e9d810279f84b30738f7790c0ed15f8dd5b9024a upstream. Switching a persistent GPIO line from input to output acquires a runtime PM reference on the parent device, but if the subsequent regmap_update_bits() fails the reference is never dropped and no later direction_in() can balance it since the direction was never changed. Drop the reference on the update failure path. Fixes: 27a49ed17e22 ("gpio: arizona: Add support for GPIOs that need to be maintained") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang Reviewed-by: Charles Keepax Link: https://patch.msgid.link/20260916094701.2007509-1-vulab@iscas.ac.cn Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-arizona.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/gpio/gpio-arizona.c +++ b/drivers/gpio/gpio-arizona.c @@ -117,8 +117,12 @@ static int arizona_gpio_direction_out(st if (value) value = ARIZONA_GPN_LVL; - return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, - ARIZONA_GPN_DIR | ARIZONA_GPN_LVL, value); + ret = regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, + ARIZONA_GPN_DIR | ARIZONA_GPN_LVL, value); + if (ret < 0 && (val & ARIZONA_GPN_DIR) && persistent) + pm_runtime_put_autosuspend(chip->parent); + + return ret; } static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)