Skip to contentSkip to conversation

mailbox: PCC: Fix return value of pcc_mbox_request_channel()

PATCH Applied Hoan Tran 2 participants 2 messages Oct 14, 2016 – Oct 21, 2016

Subsystems (2)
lore
Share & tools
lore

Hoan Tran

author
#0 lore raw

PATCH 1/1 mailbox: PCC: Fix return value of pcc_mbox_request_channel()

When CONFIG_PCC is disabled, pcc_mbox_request_channel() needs to return ERR_PTR(-ENODEV), not a NULL pointer, as the callers of this function use IS_ERR() to check for error code.

---
 include/acpi/pcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/pcc.h +1 -1
index 17a940a..8caa79c 100644
@@ -21,7 +21,7 @@ extern struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
 static inline struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
 							 int subspace_id)
 {
-	return NULL;
+	return ERR_PTR(-ENODEV);
 }
 static inline void pcc_mbox_free_channel(struct mbox_chan *chan) { }
 #endif
Signature · 1 line
1.9.1
#1 lore raw
Quoted 16 lines · Hoan Tran

When CONFIG_PCC is disabled, pcc_mbox_request_channel() needs to return ERR_PTR(-ENODEV), not a NULL pointer, as the callers of this function use IS_ERR() to check for error code.

---
 include/acpi/pcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/pcc.h +0 -0
index 17a940a..8caa79c 100644

include/acpi/pcc.h extern struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl, · line 27

Quoted 8 lines
include/acpi/pcc.h +1 -1
@@ -21,7 +21,7 @@ extern struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
 static inline struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
 							 int subspace_id)
 {
-	return NULL;
+	return ERR_PTR(-ENODEV);
 }
 static inline void pcc_mbox_free_channel(struct mbox_chan *chan) { }
 #endif

Applied.

Thanks,
Rafael