[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b1b2395-c7c5-44a4-b0b0-6d091c7f46a2@moroto.mountain>
Date: Mon, 4 Dec 2023 15:29:29 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Hans de Goede <hdegoede@...hat.com>
Cc: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH] platform/x86: x86-android-tablets: Fix an IS_ERR() vs NULL
check in probe
The spi_new_device() function returns NULL on error, it doesn't return
error pointers.
Fixes: 70505ea6de24 ("platform/x86: x86-android-tablets: Add support for SPI device instantiation")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
drivers/platform/x86/x86-android-tablets/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index 6a5975ac3286..f8221a15575b 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -220,8 +220,8 @@ static __init int x86_instantiate_spi_dev(const struct x86_dev_info *dev_info, i
spi_devs[idx] = spi_new_device(controller, &board_info);
put_device(&controller->dev);
- if (IS_ERR(spi_devs[idx]))
- return dev_err_probe(&controller->dev, PTR_ERR(spi_devs[idx]),
+ if (!spi_devs[idx])
+ return dev_err_probe(&controller->dev, -ENOMEM,
"creating SPI-device %d\n", idx);
return 0;
--
2.42.0
Powered by blists - more mailing lists