Skip to contentSkip to conversation

rtc: optee: Fix a couple error codes

PATCH Applied Dan Carpenter 2 participants 4 messages Sep 18, 2025 – Oct 5, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover rtc: optee: Fix a couple error codes

Fix a couple error codes detected by Smatch.

Dan Carpenter (2):
rtc: optee: fix error code in probe()
rtc: optee: Fix error code in optee_rtc_read_alarm()

 drivers/rtc/rtc-optee.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/2 rtc: optee: fix error code in probe()

Return an error code if kthread_create() fails. Currently the code returns success.

Fixes 6266aea864fa ("rtc: optee: add alarm related rtc ops to optee rtc driver")
---
 drivers/rtc/rtc-optee.c | 1 +
 1 file changed, 1 insertion(+)
drivers/rtc/rtc-optee.c +1 -0
index 27db403e3047..7b44d7723cae 100644
@@ -614,6 +614,7 @@ static int optee_rtc_probe(struct device *dev)
 						  priv, "rtc_alarm_evt");
 		if (IS_ERR(priv->alarm_task)) {
 			dev_err(dev, "Failed to create alarm thread\n");
+			err = PTR_ERR(priv->alarm_task);
 			goto out_shm;
 		}
 
Signature · 1 line
2.51.0
#2 lore raw

PATCH 2/2 rtc: optee: Fix error code in optee_rtc_read_alarm()

In reply to Dan Carpenter

Return "optee_alarm" instead of "alarm". The "alarm" pointer is a valid pointer and not an error pointer.

Fixes 6266aea864fa ("rtc: optee: add alarm related rtc ops to optee rtc driver")
---
 drivers/rtc/rtc-optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-optee.c +1 -1
index 7b44d7723cae..3d5662aa1bd8 100644
@@ -299,7 +299,7 @@ static int optee_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 
 	optee_alarm = tee_shm_get_va(priv->shm, 0);
 	if (IS_ERR(optee_alarm))
-		return PTR_ERR(alarm);
+		return PTR_ERR(optee_alarm);
 
 	if (param[0].u.memref.size != sizeof(*optee_alarm))
 		return -EPROTO;
Signature · 1 line
2.51.0
maintainer Applied
#3 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Dan Carpenter

Fix a couple error codes detected by Smatch.

Dan Carpenter (2):
rtc: optee: fix error code in probe()
rtc: optee: Fix error code in optee_rtc_read_alarm()

drivers/rtc/rtc-optee.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)

[...]

Applied, thanks!

[1/2] rtc: optee: fix error code in probe()

      https://git.kernel.org/abelloni/c/8bbd727453b4
[2/2] rtc: optee: Fix error code in optee_rtc_read_alarm()
      https://git.kernel.org/abelloni/c/eb7392a01964

Best regards,

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com