[PATCH] powerpc: use appropriate error codes

From: mirimmad
Date: Sat Jun 03 2023 - 11:01:25 EST


From: Immad Mir <mirimmad17@xxxxxxxxx>

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

Signed-off-by: Immad Mir <mirimmad17@xxxxxxxxx>
---
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