From cce8ccca80d8388982133192d0a6d9dc2e8ed712 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 22 Aug 2019 11:06:32 -0300 Subject: media: use the BIT() macro As warned by cppcheck: [drivers/media/dvb-frontends/cx24123.c:434]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour [drivers/media/pci/bt8xx/bttv-input.c:87]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour [drivers/media/pci/bt8xx/bttv-input.c:98]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour ... [drivers/media/v4l2-core/v4l2-ioctl.c:1391]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour There are lots of places where we're doing 1 << 31. That's bad, as, depending on the architecture, this has an undefined behavior. The BIT() macro is already prepared to handle this, so, let's just switch all "1 << number" macros by BIT(number) at the header files with has 1 << 31. Reviewed-by: Sylwester Nawrocki # exynos4-is and s3c-camif Reviewed-by: Laurent Pinchart # omap3isp, vsp1, xilinx, wl128x and ipu3 Reviewed-by: Benoit Parrot # am437x and ti-vpe Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/ipu3/ipu3-tables.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging/media/ipu3') diff --git a/drivers/staging/media/ipu3/ipu3-tables.h b/drivers/staging/media/ipu3/ipu3-tables.h index a1bf3286f380..9f719c48b432 100644 --- a/drivers/staging/media/ipu3/ipu3-tables.h +++ b/drivers/staging/media/ipu3/ipu3-tables.h @@ -4,6 +4,8 @@ #ifndef __IPU3_TABLES_H #define __IPU3_TABLES_H +#include + #include "ipu3-abi.h" #define IMGU_BDS_GRANULARITY 32 /* Downscaling granularity */ @@ -12,7 +14,7 @@ #define IMGU_SCALER_DOWNSCALE_4TAPS_LEN 128 #define IMGU_SCALER_DOWNSCALE_2TAPS_LEN 64 -#define IMGU_SCALER_FP ((u32)1 << 31) /* 1.0 in fixed point */ +#define IMGU_SCALER_FP BIT(31) /* 1.0 in fixed point */ #define IMGU_XNR3_VMEM_LUT_LEN 16 -- cgit v1.2.3