From: Stefan Wahren <stefan.wahren@xxxxxxxx> commit abf2836a381a30763e24acd58da56fa615c6581a upstream. Replace the custom set of return values with proper Linux error codes for vchiq_initialise(). Reviewed-by: Nicolas Saenz Julienne <nsaenz@xxxxxxxxxx> Signed-off-by: Stefan Wahren <stefan.wahren@xxxxxxxx> Link: https://lore.kernel.org/r/1619347863-16080-11-git-send-email-stefan.wahren@xxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 20 +++++----- 1 file changed, 11 insertions(+), 9 deletions(-) --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -147,12 +147,11 @@ vchiq_blocking_bulk_transfer(unsigned in unsigned int size, enum vchiq_bulk_dir dir); #define VCHIQ_INIT_RETRIES 10 -enum vchiq_status vchiq_initialise(struct vchiq_instance **instance_out) +int vchiq_initialise(struct vchiq_instance **instance_out) { - enum vchiq_status status = VCHIQ_ERROR; struct vchiq_state *state; struct vchiq_instance *instance = NULL; - int i; + int i, ret; vchiq_log_trace(vchiq_core_log_level, "%s called", __func__); @@ -169,6 +168,7 @@ enum vchiq_status vchiq_initialise(struc if (i == VCHIQ_INIT_RETRIES) { vchiq_log_error(vchiq_core_log_level, "%s: videocore not initialized\n", __func__); + ret = -ENOTCONN; goto failed; } else if (i > 0) { vchiq_log_warning(vchiq_core_log_level, @@ -180,6 +180,7 @@ enum vchiq_status vchiq_initialise(struc if (!instance) { vchiq_log_error(vchiq_core_log_level, "%s: error allocating vchiq instance\n", __func__); + ret = -ENOMEM; goto failed; } @@ -190,13 +191,13 @@ enum vchiq_status vchiq_initialise(struc *instance_out = instance; - status = VCHIQ_SUCCESS; + ret = 0; failed: vchiq_log_trace(vchiq_core_log_level, - "%s(%p): returning %d", __func__, instance, status); + "%s(%p): returning %d", __func__, instance, ret); - return status; + return ret; } EXPORT_SYMBOL(vchiq_initialise); @@ -2223,6 +2224,7 @@ vchiq_keepalive_thread_func(void *v) enum vchiq_status status; struct vchiq_instance *instance; unsigned int ka_handle; + int ret; struct vchiq_service_params_kernel params = { .fourcc = VCHIQ_MAKE_FOURCC('K', 'E', 'E', 'P'), @@ -2231,10 +2233,10 @@ vchiq_keepalive_thread_func(void *v) .version_min = KEEPALIVE_VER_MIN }; - status = vchiq_initialise(&instance); - if (status != VCHIQ_SUCCESS) { + ret = vchiq_initialise(&instance); + if (ret) { vchiq_log_error(vchiq_susp_log_level, - "%s vchiq_initialise failed %d", __func__, status); + "%s vchiq_initialise failed %d", __func__, ret); goto exit; }