mbox series

[0/3] media: Fix missing warnings for llvm am32

Message ID 20240410-pack-v1-0-70f287dd8a66@chromium.org
Headers show
Series media: Fix missing warnings for llvm am32 | expand

Message

Ricardo Ribalda April 10, 2024, 12:24 p.m. UTC
When we were building the project with llvm for arm32 a number of
warnings where shown.

This is passing the ABI check:
https://gitlab.freedesktop.org/linux-media/media-staging/-/jobs/57432144

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Ricardo Ribalda (3):
      media: dvb: as102-fe: Fix as10x_register_addr packing
      media: dvb: Fix dtvs_stats packing.
      media: videodev2: Fix v4l2_ext-control packing.

 drivers/media/dvb-frontends/as102_fe_types.h | 2 +-
 include/uapi/linux/dvb/frontend.h            | 2 +-
 include/uapi/linux/videodev2.h               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: d8c9a6e204f1466d228428174ce6d40ccdfb583e
change-id: 20240410-pack-e719cdfa0a6f

Best regards,

Comments

Hans Verkuil April 12, 2024, 2:19 p.m. UTC | #1
On 10/04/2024 14:24, Ricardo Ribalda wrote:
> This structure is embedded in multiple other structures that are packed,
> which conflicts with it being aligned.
> 
> drivers/media/usb/as102/as10x_cmd.h:379:30: warning: field reg_addr within 'struct as10x_dump_memory::(unnamed at drivers/media/usb/as102/as10x_cmd.h:373:2)' is less aligned than 'struct as10x_register_addr' and is usually due to 'struct as10x_dump_memory::(unnamed at drivers/media/usb/as102/as10x_cmd.h:373:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> 
> Mark it as being packed.
> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/dvb-frontends/as102_fe_types.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-frontends/as102_fe_types.h b/drivers/media/dvb-frontends/as102_fe_types.h
> index 297f9520ebf9d..8a4e392c88965 100644
> --- a/drivers/media/dvb-frontends/as102_fe_types.h
> +++ b/drivers/media/dvb-frontends/as102_fe_types.h
> @@ -174,6 +174,6 @@ struct as10x_register_addr {
>  	uint32_t addr;
>  	/* register mode access */
>  	uint8_t mode;
> -};
> +} __packed;

Changing the layout of a struct is scary, but in this case I believe
as10x_register_addr isn't actually used in this driver at all.

So this looks OK.

Regards,

	Hans

>  
>  #endif
>