diff mbox series

[1/8] arm_ffa: Add NULL pointer check to the driver operations

Message ID 20241101142017.79311-2-abdellatif.elkhlifi@arm.com
State Needs Review / ACK
Delegated to: Tom Rini
Headers show
Series arm_ffa: Add FFA_MEM_SHARE and FFA_MEM_RECLAIM support | expand

Commit Message

Abdellatif El Khlifi Nov. 1, 2024, 2:20 p.m. UTC
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>

Add NULL pointer check for ops

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
---
 drivers/firmware/arm-ffa/arm-ffa-uclass.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ilias Apalodimas Nov. 1, 2024, 3:14 p.m. UTC | #1
Hi Abdellatif,

Something is wrong on your setup and you only cc'ed people on the cover
letter.

On Fri, Nov 01, 2024 at 02:20:10PM +0000, abdellatif.elkhlifi@arm.com wrote:
> From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
>
> Add NULL pointer check for ops
>
> Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
> ---
>  drivers/firmware/arm-ffa/arm-ffa-uclass.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/arm-ffa/arm-ffa-uclass.c b/drivers/firmware/arm-ffa/arm-ffa-uclass.c
> index 96c64964bb7..5ec7654ed1c 100644
> --- a/drivers/firmware/arm-ffa/arm-ffa-uclass.c
> +++ b/drivers/firmware/arm-ffa/arm-ffa-uclass.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  /*
> - * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
> + * Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
>   *
>   * Authors:
>   *   Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
> @@ -954,7 +954,7 @@ int ffa_partition_info_get(struct udevice *dev, const char *uuid_str,
>  {
>  	struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> -	if (!ops->partition_info_get)
> +	if (!ops || !ops->partition_info_get)
>  		return -ENOSYS;
>
>  	return ops->partition_info_get(dev, uuid_str, sp_count, sp_descs);
> @@ -979,7 +979,7 @@ int ffa_sync_send_receive(struct udevice *dev, u16 dst_part_id,
>  {
>  	struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> -	if (!ops->sync_send_receive)
> +	if (!ops || !ops->sync_send_receive)
>  		return -ENOSYS;
>
>  	return ops->sync_send_receive(dev, dst_part_id, msg, is_smc64);
> @@ -1000,7 +1000,7 @@ int ffa_rxtx_unmap(struct udevice *dev)
>  {
>  	struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> -	if (!ops->rxtx_unmap)
> +	if (!ops || !ops->rxtx_unmap)
>  		return -ENOSYS;
>
>  	return ops->rxtx_unmap(dev);
> --
> 2.25.1
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Jens Wiklander Nov. 4, 2024, 12:48 p.m. UTC | #2
On Fri, Nov 1, 2024 at 3:20 PM <abdellatif.elkhlifi@arm.com> wrote:
>
> From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
>
> Add NULL pointer check for ops
>
> Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
> ---
>  drivers/firmware/arm-ffa/arm-ffa-uclass.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Looks good.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Cheers,
Jens

>
> diff --git a/drivers/firmware/arm-ffa/arm-ffa-uclass.c b/drivers/firmware/arm-ffa/arm-ffa-uclass.c
> index 96c64964bb7..5ec7654ed1c 100644
> --- a/drivers/firmware/arm-ffa/arm-ffa-uclass.c
> +++ b/drivers/firmware/arm-ffa/arm-ffa-uclass.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  /*
> - * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
> + * Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
>   *
>   * Authors:
>   *   Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
> @@ -954,7 +954,7 @@ int ffa_partition_info_get(struct udevice *dev, const char *uuid_str,
>  {
>         struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> -       if (!ops->partition_info_get)
> +       if (!ops || !ops->partition_info_get)
>                 return -ENOSYS;
>
>         return ops->partition_info_get(dev, uuid_str, sp_count, sp_descs);
> @@ -979,7 +979,7 @@ int ffa_sync_send_receive(struct udevice *dev, u16 dst_part_id,
>  {
>         struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> -       if (!ops->sync_send_receive)
> +       if (!ops || !ops->sync_send_receive)
>                 return -ENOSYS;
>
>         return ops->sync_send_receive(dev, dst_part_id, msg, is_smc64);
> @@ -1000,7 +1000,7 @@ int ffa_rxtx_unmap(struct udevice *dev)
>  {
>         struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> -       if (!ops->rxtx_unmap)
> +       if (!ops || !ops->rxtx_unmap)
>                 return -ENOSYS;
>
>         return ops->rxtx_unmap(dev);
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/firmware/arm-ffa/arm-ffa-uclass.c b/drivers/firmware/arm-ffa/arm-ffa-uclass.c
index 96c64964bb7..5ec7654ed1c 100644
--- a/drivers/firmware/arm-ffa/arm-ffa-uclass.c
+++ b/drivers/firmware/arm-ffa/arm-ffa-uclass.c
@@ -1,6 +1,6 @@ 
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
  *
  * Authors:
  *   Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
@@ -954,7 +954,7 @@  int ffa_partition_info_get(struct udevice *dev, const char *uuid_str,
 {
 	struct ffa_bus_ops *ops = ffa_get_ops(dev);
 
-	if (!ops->partition_info_get)
+	if (!ops || !ops->partition_info_get)
 		return -ENOSYS;
 
 	return ops->partition_info_get(dev, uuid_str, sp_count, sp_descs);
@@ -979,7 +979,7 @@  int ffa_sync_send_receive(struct udevice *dev, u16 dst_part_id,
 {
 	struct ffa_bus_ops *ops = ffa_get_ops(dev);
 
-	if (!ops->sync_send_receive)
+	if (!ops || !ops->sync_send_receive)
 		return -ENOSYS;
 
 	return ops->sync_send_receive(dev, dst_part_id, msg, is_smc64);
@@ -1000,7 +1000,7 @@  int ffa_rxtx_unmap(struct udevice *dev)
 {
 	struct ffa_bus_ops *ops = ffa_get_ops(dev);
 
-	if (!ops->rxtx_unmap)
+	if (!ops || !ops->rxtx_unmap)
 		return -ENOSYS;
 
 	return ops->rxtx_unmap(dev);