[PATCH] gpio: tegra: return -ENOMEM on allocation failure in probe

Samasth Norway Ananda posted 1 patch 2 months ago
drivers/gpio/gpio-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] gpio: tegra: return -ENOMEM on allocation failure in probe
Posted by Samasth Norway Ananda 2 months ago
devm_kzalloc() failure in tegra_gpio_probe() returns -ENODEV, which
indicates "no such device". The correct error code for a memory
allocation failure is -ENOMEM.

Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
---
 drivers/gpio/gpio-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index b14052fe64ac..df06b56a2ade 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -698,7 +698,7 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 
 	tgi = devm_kzalloc(&pdev->dev, sizeof(*tgi), GFP_KERNEL);
 	if (!tgi)
-		return -ENODEV;
+		return -ENOMEM;
 
 	tgi->soc = of_device_get_match_data(&pdev->dev);
 	tgi->dev = &pdev->dev;
-- 
2.50.1
Re: [PATCH] gpio: tegra: return -ENOMEM on allocation failure in probe
Posted by Bartosz Golaszewski 2 months ago
On Thu, 09 Apr 2026 11:58:53 -0700, Samasth Norway Ananda wrote:
> devm_kzalloc() failure in tegra_gpio_probe() returns -ENODEV, which
> indicates "no such device". The correct error code for a memory
> allocation failure is -ENOMEM.
> 
> 

Applied, thanks!

[1/1] gpio: tegra: return -ENOMEM on allocation failure in probe
      https://git.kernel.org/brgl/c/57df6923ca53b524d06d2347b896d9de74b3bc86

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>