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 9C14537B40C; Tue, 21 Jul 2026 17:03:21 +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=1784653402; cv=none; b=HqTZOUV55K+NOgabiAILix22RzA/IRzRb6pi2i4weHnEpuA/1ltDAijsVHYKgvQR8ssmvpdkVd3bTruXdMYThn+EmcIw1Sb2wZhEIq9TLJYb96Nd9fopyy3lnT/5t7QtuNuFv66stqMtXHud7waPRC4UGNg+mkwmt0ujnS6pqDI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784653402; c=relaxed/simple; bh=0OpkOWnF8MvzM2JVQ3oZqsmYp6MQUiZFXhndG27hhB8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JJAYH650Daar7bciFT/YgW0UVKlw4Cgi4EJHnOQOXc8zWHW4L59OX0XooIS8Hy8JNUjBrc/79+xp5NWImLZdzNoMAq+drlDeMboFafYWpdyRr8l9c/4X1w8zzIzX6LYgwRxF0Ip9A5svR4QvVgCL/mrG8Y9YTZpW832hH45REK8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VhYyvqsB; 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="VhYyvqsB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE0FC1F000E9; Tue, 21 Jul 2026 17:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784653401; bh=ns0ODY6qsJJeg4ac+k3Pi15ryHvyCik5+9lxa9lFhU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VhYyvqsBDrj99YlS2hCYRTa2Xm1DiRX4uac868hQwflcbl06uOEyrRg7UnuTiQRam vrskhdSbqm7JZEPVsCOd3nhPtliqy5vT7HvKiOV77K3GE1ZY+7+jsvIBpIBQ372Rkv XcubK2T9mKXzVOlRIhijw7LLJJQlB3wGyL3UcQ8U= 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 7.1 1313/2077] gpio: htc-egpio: use managed gpiochip registration Date: Tue, 21 Jul 2026 17:16:26 +0200 Message-ID: <20260721152623.791091649@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@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 7.1-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 d15423c718d033..25a4d4494f3c3a 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, struct_size(ei, chip, pdata->num_chips), GFP_KERNEL); @@ -326,7 +327,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