[PATCH 01/25] arm_ffa: Add NULL pointer check to the uclass driver operations
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Fri Jul 4 14:12:29 CEST 2025
On 02.07.25 17:25, abdellatif.elkhlifi at arm.com wrote:
> From: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
>
> Add NULL pointer check for ops
>
> The device driver can miss defining an operations structure.
> So, ffa_get_ops() can return NULL.
> This commit adds checks for ops in the uclass driver operations
> and an error is returned when ops is NULL.
>
> Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Reviewed-by: Jens Wiklander <jens.wiklander at linaro.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Casey Connolly <casey.connolly at linaro.org>
> ---
> drivers/firmware/arm-ffa/arm-ffa-uclass.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/arm-ffa/arm-ffa-uclass.c b/drivers/firmware/arm-ffa/arm-ffa-uclass.c
> index 96c64964bb7..f8d231204db 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 at arm.com>
> + * Copyright 2022-2023, 2025 Arm Limited and/or its affiliates <open-source-office at arm.com>
> *
> * Authors:
> * Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
> @@ -954,6 +954,9 @@ int ffa_partition_info_get(struct udevice *dev, const char *uuid_str,
> {
> struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> + if (!ops)
> + return -EINVAL;
uclasses that use ops typically don't check for NULL.
Why would we have an FFA driver without ops?
Would such a driver be of any use?
Best regards
Heinrich
> +
> if (!ops->partition_info_get)
> return -ENOSYS;
>
> @@ -979,6 +982,9 @@ int ffa_sync_send_receive(struct udevice *dev, u16 dst_part_id,
> {
> struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> + if (!ops)
> + return -EINVAL;
> +
> if (!ops->sync_send_receive)
> return -ENOSYS;
>
> @@ -1000,6 +1006,9 @@ int ffa_rxtx_unmap(struct udevice *dev)
> {
> struct ffa_bus_ops *ops = ffa_get_ops(dev);
>
> + if (!ops)
> + return -EINVAL;
> +
> if (!ops->rxtx_unmap)
> return -ENOSYS;
>
More information about the U-Boot
mailing list