Replace the custom set of return values with proper Linux error codes. As a result we need to initialize vchiq_status in vchiq_init_state. Signed-off-by: Stefan Wahren <stefan.wahren@xxxxxxxx> --- .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 12 ++++++------ .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 11 +++++------ .../staging/vc04_services/interface/vchiq_arm/vchiq_core.h | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 7c336d0..a644fe6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -169,21 +169,21 @@ int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state) return 0; } -enum vchiq_status +int vchiq_platform_init_state(struct vchiq_state *state) { struct vchiq_2835_state *platform_state; state->platform_state = kzalloc(sizeof(*platform_state), GFP_KERNEL); if (!state->platform_state) - return VCHIQ_ERROR; + return -ENOMEM; platform_state = (struct vchiq_2835_state *)state->platform_state; platform_state->inited = 1; vchiq_arm_init_state(state, &platform_state->arm_state); - return VCHIQ_SUCCESS; + return 0; } struct vchiq_arm_state* @@ -211,7 +211,7 @@ remote_event_signal(struct remote_event *event) writel(0, g_regs + BELL2); /* trigger vc interrupt */ } -enum vchiq_status +int vchiq_prepare_bulk_data(struct vchiq_bulk *bulk, void *offset, void __user *uoffset, int size, int dir) { @@ -223,7 +223,7 @@ vchiq_prepare_bulk_data(struct vchiq_bulk *bulk, void *offset, : PAGELIST_WRITE); if (!pagelistinfo) - return VCHIQ_ERROR; + return -ENOMEM; bulk->data = pagelistinfo->dma_addr; @@ -233,7 +233,7 @@ vchiq_prepare_bulk_data(struct vchiq_bulk *bulk, void *offset, */ bulk->remote_data = pagelistinfo; - return VCHIQ_SUCCESS; + return 0; } void diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 9dc9a6a..9f9677a 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2162,9 +2162,9 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) { struct vchiq_shared_state *local; struct vchiq_shared_state *remote; - enum vchiq_status status; + enum vchiq_status status = VCHIQ_SUCCESS; char threadname[16]; - int i; + int i, ret; if (vchiq_states[0]) { pr_err("%s: VCHIQ state already initialized\n", __func__); @@ -2246,8 +2246,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) local->debug[DEBUG_ENTRIES] = DEBUG_MAX; - status = vchiq_platform_init_state(state); - if (status != VCHIQ_SUCCESS) + ret = vchiq_platform_init_state(state); + if (ret) return VCHIQ_ERROR; /* @@ -3141,8 +3141,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, bulk->size = size; bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED; - if (vchiq_prepare_bulk_data(bulk, offset, uoffset, size, dir) - != VCHIQ_SUCCESS) + if (vchiq_prepare_bulk_data(bulk, offset, uoffset, size, dir)) goto unlock_error_exit; wmb(); diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index b817097..6b3a907 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -644,7 +644,7 @@ vchiq_queue_message(unsigned int handle, * implementations must be provided. */ -extern enum vchiq_status +extern int vchiq_prepare_bulk_data(struct vchiq_bulk *bulk, void *offset, void __user *uoffset, int size, int dir); @@ -679,7 +679,7 @@ vchiq_on_remote_use(struct vchiq_state *state); extern void vchiq_on_remote_release(struct vchiq_state *state); -extern enum vchiq_status +extern int vchiq_platform_init_state(struct vchiq_state *state); extern enum vchiq_status -- 2.7.4