[PATCH RESEND 1/2] mci: core: remove dev_add_param_bool error paths

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jun 17 04:41:41 PDT 2024


dev_add_param_bool fails when the device already has a parameter with
the same name or if there's no memory. The first error can't happen here
and the second won't go unnoticed anyway as something critical is bound
to panic.

Remove thus the error paths, which are never triggered.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> RESEND:
  - add missing prerequisite patch
---
 drivers/mci/mci-core.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 9aa0f284fdd3..d40519f124b9 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -2509,7 +2509,6 @@ int mci_register(struct mci_host *host)
 {
 	struct mci *mci;
 	struct device *hw_dev;
-	struct param_d *param;
 	int ret;
 
 	mci = xzalloc(sizeof(*mci));
@@ -2554,23 +2553,11 @@ int mci_register(struct mci_host *host)
 
 	dev_info(hw_dev, "registered as %s\n", dev_name(&mci->dev));
 
-	param = dev_add_param_bool(&mci->dev, "probe", mci_set_probe, NULL,
-				   &mci->probe, mci);
+	dev_add_param_bool(&mci->dev, "probe", mci_set_probe, NULL,
+			   &mci->probe, mci);
 
-	if (IS_ERR(param) && PTR_ERR(param) != -ENOSYS) {
-		ret = PTR_ERR(param);
-		dev_dbg(&mci->dev, "Failed to add 'probe' parameter to the MCI device\n");
-		goto err_unregister;
-	}
-
-	param = dev_add_param_bool(&mci->dev, "broken_cd", NULL, NULL,
-				   &host->broken_cd, mci);
-
-	if (IS_ERR(param) && PTR_ERR(param) != -ENOSYS) {
-		ret = PTR_ERR(param);
-		dev_dbg(&mci->dev, "Failed to add 'broken_cd' parameter to the MCI device\n");
-		goto err_unregister;
-	}
+	dev_add_param_bool(&mci->dev, "broken_cd", NULL, NULL,
+			   &host->broken_cd, mci);
 
 	if (IS_ENABLED(CONFIG_MCI_INFO))
 		mci->dev.info = mci_info;
@@ -2586,8 +2573,6 @@ int mci_register(struct mci_host *host)
 
 	return 0;
 
-err_unregister:
-	unregister_device(&mci->dev);
 err_free:
 	free(mci);
 
-- 
2.39.2




More information about the barebox mailing list