mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Sangbeom Kim <sbkim73@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Lee Jones <lee.jones@linaro.org>,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Subject: [PATCH 2/2] mfd: sec-core: Return gracefully instead of BUG() if device cannot match
Date: Tue, 29 Jan 2019 12:25:53 +0100	[thread overview]
Message-ID: <1548761153-28114-2-git-send-email-krzk@kernel.org> (raw)
In-Reply-To: <1548761153-28114-1-git-send-email-krzk@kernel.org>

Replace impossible BUG() in probe with a proper return.  This can be
triggered only in case of a clear bug (e.g. adding broken half-support
for new S2MPSXX flavor) but BUG() is discouraged and the boot process
can actually try to continue.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/mfd/sec-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index c3bb53f79e63..2c2f48b24eeb 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -474,8 +474,9 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 		num_sec_devs = ARRAY_SIZE(s2mpu02_devs);
 		break;
 	default:
-		/* If this happens the probe function is problem */
-		BUG();
+		dev_err(&i2c->dev, "Unsupported device type (%lu)\n",
+			sec_pmic->device_type);
+		return -ENODEV;
 	}
 	ret = devm_mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs,
 				   NULL, 0, NULL);
-- 
2.7.4


  reply	other threads:[~2019-01-29 11:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 11:25 [PATCH 1/2] mfd: sec-core: Cleanup formatting to a consistent style Krzysztof Kozlowski
2019-01-29 11:25 ` Krzysztof Kozlowski [this message]
2019-02-01  9:22   ` [PATCH 2/2] mfd: sec-core: Return gracefully instead of BUG() if device cannot match Lee Jones
2019-02-01  9:21 ` [PATCH 1/2] mfd: sec-core: Cleanup formatting to a consistent style Lee Jones
2019-02-11 13:14   ` Krzysztof Kozlowski

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=1548761153-28114-2-git-send-email-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=sbkim73@samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome