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 1F4D0471264; Tue, 21 Jul 2026 18:18:54 +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=1784657935; cv=none; b=tOAb1emw7gnxp92femC7TZJ6Oq4eFp8iluGqzPF1nSf+pF8mJi9FFjnG536g3GK6n8Z7H2UO8QxmYz6ajmLmRcql5UsCdIkCnHsM0NoDlCavhb2onWvxu+f4MXxLNNDsa9BBZ7XziTl7N84kqIjNOYp1Z/pBfJcg2Q3MrmrMZDU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784657935; c=relaxed/simple; bh=s1Oe2xWtmhf1QA12e/HsRdgNpW5Dc1/IuaCrBnOf00Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DEfbYmCK6AbXntLNWR6UIg8ZH5yuf3SdSR4MVV8pMCj5gPVQYeqF//P1g9QThLMeKNYETtYLwlDCrUIlq7izP9bQJy+e9JnMkOaRurY+ZoreSOuNN3L2LqbKd3TmIjsGaQbRJQuOodFC9ernCzx6SseWTBQlBEG5yO3ojoY+iI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L4AckzfI; 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="L4AckzfI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80D161F000E9; Tue, 21 Jul 2026 18:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784657934; bh=A6XXvGZoD7SNYk/KLl5JqJXAZL2IUXAY/XR61A2IYjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=L4AckzfId3J862FoprjAnYFHD4/7DPamCSnag+hzsPqZ5wYPMeVFomPnDfviwGu/S HDtuFn/zfi774FvRTQxu1VxpkcSgtEINxwA/LF2Zsn2+04fG5mcdlSCqwxeEiMq1ra hEQtowjXIFvl1zl+AeoVC1Q3vdZGHPa74s2O7Ig4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pengpeng Hou , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.18 0953/1611] gpio: htc-egpio: use managed gpiochip registration Date: Tue, 21 Jul 2026 17:17:49 +0200 Message-ID: <20260721152536.827561832@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pengpeng Hou [ Upstream commit 17326db5f0ab4ec1901e75d052b5ebef486b467f ] egpio_probe() registers each nested gpio_chip with gpiochip_add_data() but ignores the return value. If one registration fails, probe still returns success even though one of the chips was not published to gpiolib. Use devm_gpiochip_add_data() and fail probe if any chip registration fails. This lets devres unwind already registered chips and prevents the driver from publishing a partially initialized device. Fixes: a1635b8fe59d ("[ARM] 4947/1: htc-egpio, a driver for GPIO/IRQ expanders with fixed input/output pins") Signed-off-by: Pengpeng Hou Link: https://patch.msgid.link/20260624131828.94139-1-pengpeng@iscas.ac.cn Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-htc-egpio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-htc-egpio.c b/drivers/gpio/gpio-htc-egpio.c index 2eaed83214d828..8c583d6a7c96fc 100644 --- a/drivers/gpio/gpio-htc-egpio.c +++ b/drivers/gpio/gpio-htc-egpio.c @@ -268,6 +268,7 @@ static int __init egpio_probe(struct platform_device *pdev) struct gpio_chip *chip; unsigned int irq, irq_end; int i; + int ret; /* Initialize ei data structure. */ ei = devm_kzalloc(&pdev->dev, sizeof(*ei), GFP_KERNEL); @@ -331,7 +332,10 @@ static int __init egpio_probe(struct platform_device *pdev) chip->base = pdata->chip[i].gpio_base; chip->ngpio = pdata->chip[i].num_gpios; - gpiochip_add_data(chip, &ei->chip[i]); + ret = devm_gpiochip_add_data(&pdev->dev, chip, &ei->chip[i]); + if (ret) + return dev_err_probe(&pdev->dev, ret, + "failed to register gpiochip %d\n", i); } /* Set initial pin values */ -- 2.53.0