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 5BD2151CF41; Wed, 30 Sep 2026 18:24:13 +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=1790792654; cv=none; b=rp8lknTxJMVJ3O65VNBgMAmKY1/Sfc+oJj2e+9jOrFRp+1CwJ3wFz+jqeE99D2HAsvGxMFs5lyJwmRdRELdajSxCVPREh1ud3q+TebKurnlC0rCUrrBw/oa8hllf0Zp3bKm2Kt85TuhJzRTzubTsFo52yYHzpTTZvz29BB6xm/o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790792654; c=relaxed/simple; bh=cSuWolIEY266re1+AQUOn2Fgv8pdxQn/jMqgILoTIos=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SqKjc/+qbCKLl18yh2sCwUleBQOrn045bFD1522OfuuOm/otyRvJgVgdUzkwuFwfxWhy2RhOlavR18EB4mkExZDHdc3+Gq9/Lg3vcu7/j34hoWoT0X0g70tF4Y5Mwj9baaG3FNWi2iStwMteRPj5mgvT9ES2uzCyKmbXhH//K3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=s8RxxFG1; 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="s8RxxFG1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7587A1F000FF; Wed, 30 Sep 2026 18:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790792653; bh=MgWPQ1xgZmJhpzIn12CJNP/XtA+MD+QgEjszg2X48Yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=s8RxxFG1UJEh9rnEsX4LRxNEAInmXXizbVekgo7Yc4Y84hMziXZhImHjiWnrM/lpE Rm4+nXm3s9rR7dmv27/46vmmu8ofzQ9XCptslh2Vp9rked/2G3GdYu6BgBh+CYFTvA Cfh5KYXYZjMOLCk2z9URSB6z7+1eLIppUYVwqPh8= 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 5.15 704/752] gpio: arizona: Fix runtime PM leak in arizona_gpio_direction_out() Date: Wed, 30 Sep 2026 17:29:34 +0200 Message-ID: <20260930152413.466651826@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152358.131179731@linuxfoundation.org> References: <20260930152358.131179731@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 5.15-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 @@ -118,8 +118,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)