[PATCH 6/6] staging: vc04_services: Add casts to remove warnings in vchiq_core.c

Eric Anholt eric at anholt.net
Wed Oct 19 09:24:17 PDT 2016


Michael Zoran <mzoran at crowfest.net> writes:

> From 4036f4c480c6272d3057504d49e545341ce6d865 Mon Sep 17 00:00:00 2001
> From: Michael Zoran <mzoran at crowfest.net>
> Date: Wed, 19 Oct 2016 00:46:02 -0700
> Subject: [PATCH 6/6] staging: vc04_services: Add casts to remove
> warnings in
>  vchiq_core.c
>
> When compiling vchiq_core.c for 64 bit, the compiler
> emits a few warnings that are not actual issues. This
> change adds a few casts to remove the extra unnecessary
> warnings.
>
> Signed-off-by: Michael Zoran <mzoran at crowfest.net>

Oh, interesting note that the warnings weren't actual issues (since they
all get ANDed with a mask, or are about ints-cast-as-pointers).

> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c    | 11
> ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> 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 3aa5cc4..e292629 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -1689,8 +1689,8 @@ parse_rx_slots(VCHIQ_STATE_T *state)
>  					min(64, size));
>  		}
>  
> -		if (((unsigned int)header & VCHIQ_SLOT_MASK) +
> calc_stride(size)
> -			> VCHIQ_SLOT_SIZE) {
> +		if (((unsigned long)header & VCHIQ_SLOT_MASK) +
> +		    calc_stride(size) > VCHIQ_SLOT_SIZE) {
>  			vchiq_log_error(vchiq_core_log_level,
>  				"header %pK (msgid %x) - size %x too
> big for slot",
>  				header, (unsigned int)msgid,
> @@ -1800,7 +1800,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
>  				bulk = &queue->bulks[
>  					BULK_INDEX(queue-
>>remote_insert)];
>  				bulk->remote_data =
> -					(void *)((int *)header-
>>data)[0];
> +					(void *)(long)((int *)header-
>>data)[0];
>  				bulk->remote_size = ((int *)header-
>>data)[1];
>  				wmb();
>  
> @@ -2223,7 +2223,8 @@ get_conn_state_name(VCHIQ_CONNSTATE_T conn_state)
>  VCHIQ_SLOT_ZERO_T *
>  vchiq_init_slots(void *mem_base, int mem_size)
>  {
> -	int mem_align = (VCHIQ_SLOT_SIZE - (int)mem_base) &
> VCHIQ_SLOT_MASK;
> +	int mem_align =
> +		(int)((VCHIQ_SLOT_SIZE - (long)mem_base) &
> VCHIQ_SLOT_MASK);
>  	VCHIQ_SLOT_ZERO_T *slot_zero =
>  		(VCHIQ_SLOT_ZERO_T *)((char *)mem_base + mem_align);
>  	int num_slots = (mem_size - mem_align)/VCHIQ_SLOT_SIZE;
> @@ -3303,7 +3304,7 @@ vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T
> handle,
>  				(dir == VCHIQ_BULK_TRANSMIT) ?
>  				VCHIQ_POLL_TXNOTIFY :
> VCHIQ_POLL_RXNOTIFY);
>  	} else {
> -		int payload[2] = { (int)bulk->data, bulk->size };
> +		int payload[2] = { (int)(long)bulk->data, bulk->size
> };

In these last two, I don't think you need the "(int)" casts, but either
way is fine with me.

Reviewed-by: Eric Anholt <eric at anholt.net>

general process note: When resending a patch, it's good to amend in any
Reviewed-by, Acked-by, etc. tags that people have sent for your previous
copies, so they don't get lost and the maintainer that might pull your
code can see that it's had review and is ready to go.

>  		VCHIQ_ELEMENT_T element = { payload, sizeof(payload)
> };
>  
>  		status = queue_message(state, NULL,
> -- 
> 2.9.3
>
> _______________________________________________
> linux-rpi-kernel mailing list
> linux-rpi-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-rpi-kernel/attachments/20161019/a9c3a966/attachment.sig>


More information about the linux-rpi-kernel mailing list