* [PATCH] x86/intel-mid: Add pr_warn when platform_device_add() fails
@ 2018-12-24 16:47 Aditya Pakki
0 siblings, 0 replies; only message in thread
From: Aditya Pakki @ 2018-12-24 16:47 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
H. Peter Anvin, x86, Jan Kiszka, linux-kernel
platform_device_add() may fail in intel_scu_devices_create and
sfi_handle_ipc_dev. The fix checks for the return value in these cases
and displays the failed device.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
arch/x86/platform/intel-mid/sfi.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
index 7be1e1fe9ae3..e69511bafec5 100644
--- a/arch/x86/platform/intel-mid/sfi.c
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -278,9 +278,13 @@ static void __init intel_scu_i2c_device_register(int bus,
void intel_scu_devices_create(void)
{
int i;
+ int ret;
- for (i = 0; i < ipc_next_dev; i++)
- platform_device_add(ipc_devs[i]);
+ for (i = 0; i < ipc_next_dev; i++) {
+ ret = platform_device_add(ipc_devs[i]);
+ if (ret)
+ pr_warn("can't add device %s\n", ipc_devs[i]);
+ }
for (i = 0; i < spi_next_dev; i++)
spi_register_board_info(spi_devs[i], 1);
@@ -330,6 +334,7 @@ static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry,
{
struct platform_device *pdev;
void *pdata = NULL;
+ int ret;
pr_debug("IPC bus, name = %16.16s, irq = 0x%2x\n",
pentry->name, pentry->irq);
@@ -360,8 +365,11 @@ static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry,
pdev->dev.platform_data = pdata;
if (dev->delay)
intel_scu_ipc_device_register(pdev);
- else
- platform_device_add(pdev);
+ else {
+ ret = platform_device_add(pdev);
+ if (ret)
+ pr_warn("can't add device %s\n", pdev);
+ }
}
static void __init sfi_handle_spi_dev(struct sfi_device_table_entry *pentry,
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-12-24 16:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-24 16:47 [PATCH] x86/intel-mid: Add pr_warn when platform_device_add() fails Aditya Pakki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.