diff mbox series

[11/19] firmware: turris-mox-rwtm: Return true error code if kobject_add() fails

Message ID 20240612135443.30239-12-kabel@kernel.org (mailing list archive)
State Superseded
Headers show
Series Updates for turris-mox-rwtm driver | expand

Commit Message

Marek Behún June 12, 2024, 1:54 p.m. UTC
Return the error code from kobject_add() if it fails, instead of -ENXIO.

Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/firmware/turris-mox-rwtm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c
index 84ec72575c4d..cdbe244be694 100644
--- a/drivers/firmware/turris-mox-rwtm.c
+++ b/drivers/firmware/turris-mox-rwtm.c
@@ -142,14 +142,15 @@  static const struct kobj_type mox_kobj_ktype = {
 static int mox_kobj_create(struct mox_rwtm *rwtm)
 {
 	struct kobject *kobj = &rwtm->kobj;
+	int ret;
 
 	kobject_init(kobj, &mox_kobj_ktype);
-	if (kobject_add(kobj, firmware_kobj, "turris-mox-rwtm")) {
+
+	ret = kobject_add(kobj, firmware_kobj, "turris-mox-rwtm");
+	if (ret)
 		kobject_put(kobj);
-		return -ENXIO;
-	}
 
-	return 0;
+	return ret;
 }
 
 static int mox_get_status(enum mbox_cmd cmd, u32 retval)