All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya Pakki <pakki001@umn.edu>
To: pakki001@umn.edu
Cc: kjlu@umn.edu, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Jan Kiszka <jan.kiszka@siemens.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] x86/intel-mid: Add pr_warn when platform_device_add() fails
Date: Mon, 24 Dec 2018 10:47:37 -0600	[thread overview]
Message-ID: <20181224164738.17973-1-pakki001@umn.edu> (raw)

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


                 reply	other threads:[~2018-12-24 16:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181224164738.17973-1-pakki001@umn.edu \
    --to=pakki001@umn.edu \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.