[PATCH] powerpc: use appropriate error codes

mirimmad at outlook.com mirimmad at outlook.com
Sun Jun 4 01:00:43 AEST 2023


From: Immad Mir <mirimmad17 at gmail.com>

This patch replaces use of returning -1 by appropiate error codes.

Signed-off-by: Immad Mir <mirimmad17 at gmail.com>
---
 arch/powerpc/platforms/powernv/opal-elog.c  | 4 ++--
 arch/powerpc/platforms/powernv/opal-xscom.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
index 554fdd7f8..8bb42858e 100644
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -309,12 +309,12 @@ int __init opal_elog_init(void)

 	/* ELOG not supported by firmware */
 	if (!opal_check_token(OPAL_ELOG_READ))
-		return -1;
+		return -EPERM;

 	elog_kset = kset_create_and_add("elog", NULL, opal_kobj);
 	if (!elog_kset) {
 		pr_warn("%s: failed to create elog kset\n", __func__);
-		return -1;
+		return -EPERM;
 	}

 	irq = opal_event_request(ilog2(OPAL_EVENT_ERROR_LOG_AVAIL));
diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c
index 6b4eed2ef..6df52404a 100644
--- a/arch/powerpc/platforms/powernv/opal-xscom.c
+++ b/arch/powerpc/platforms/powernv/opal-xscom.c
@@ -171,7 +171,7 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
 	if (!dir) {
 		kfree(ent->path.data);
 		kfree(ent);
-		return -1;
+		return -EPERM;
 	}

 	debugfs_create_blob("devspec", 0400, dir, &ent->path);
@@ -191,7 +191,7 @@ static int scom_debug_init(void)

 	root = debugfs_create_dir("scom", arch_debugfs_dir);
 	if (!root)
-		return -1;
+		return -EPERM;

 	rc = 0;
 	for_each_node_with_property(dn, "scom-controller") {
--
2.40.0



More information about the Linuxppc-dev mailing list