diff mbox

mailbox: PCC: Fix return value of pcc_mbox_request_channel()

Message ID 1476487221-20337-1-git-send-email-hotran@apm.com (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

hotran Oct. 14, 2016, 11:20 p.m. UTC
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.

Signed-off-by: Duc Dang <dhdang@apm.com>
Signed-off-by: Hoan Tran <hotran@apm.com>
---
 include/acpi/pcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki Oct. 21, 2016, 9:31 p.m. UTC | #1
On Friday, October 14, 2016 04:20:21 PM Hoan Tran wrote:
> 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.
> 
> Signed-off-by: Duc Dang <dhdang@apm.com>
> Signed-off-by: Hoan Tran <hotran@apm.com>
> ---
>  include/acpi/pcc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/acpi/pcc.h b/include/acpi/pcc.h
> index 17a940a..8caa79c 100644
> --- a/include/acpi/pcc.h
> +++ b/include/acpi/pcc.h
> @@ -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

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/acpi/pcc.h b/include/acpi/pcc.h
index 17a940a..8caa79c 100644
--- a/include/acpi/pcc.h
+++ b/include/acpi/pcc.h
@@ -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