From: Abdellatif El Khlifi <abdellatif.elkhl...@arm.com>

Add NULL pointer check for ops

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhl...@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-off...@arm.com>
+ * Copyright 2022-2024 Arm Limited and/or its affiliates 
<open-source-off...@arm.com>
  *
  * Authors:
  *   Abdellatif El Khlifi <abdellatif.elkhl...@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

Reply via email to