* [PATCH] staging:iio:mxs-lradc Fix large integer implicitly truncated to unsigned warning
@ 2015-12-02 18:24 Jonathan Cameron
2015-12-02 22:06 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Cameron @ 2015-12-02 18:24 UTC (permalink / raw)
To: linux-iio; +Cc: gregkh, lars, maxime.ripard, Jonathan Cameron
The change to using BIT(20) for one of the bit shifts resulted
in a constant becoming unsigned. When combined with the existing
signed constants in a couple of places, this caused possible trouble,
hence the warnings:
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_complete_touch_event’:
drivers/staging/iio/adc/mxs-lradc.c:325:5: warning: large integer implicitly truncated to unsigned type [-Woverflow]
(((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \
^
drivers/staging/iio/adc/mxs-lradc.c:734:7: note: in expansion of macro ‘LRADC_DELAY_TRIGGER’
LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) |
^
LD [M] drivers/staging/iio/accel/adis16201.o
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_preenable’:
drivers/staging/iio/adc/mxs-lradc.c:322:42: warning: large integer implicitly truncated to unsigned type [-Woverflow]
#define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24)
^
drivers/staging/iio/adc/mxs-lradc.c:1308:29: note: in expansion of macro ‘LRADC_DELAY_TRIGGER_LRADCS_MASK’
mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_postdisable’:
drivers/staging/iio/adc/mxs-lradc.c:322:42: warning: large integer implicitly truncated to unsigned type [-Woverflow]
#define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24)
^
drivers/staging/iio/adc/mxs-lradc.c:1327:29: note: in expansion of macro ‘LRADC_DELAY_TRIGGER_LRADCS_MASK’
mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
The simplest fix is to force LRADC_DELAY_TRIGGER_LRADCS_MASK to be
a shift of an unsigned 0xff rather than a signed one.
This is ugly considering it is the only constant in the driver which
is so forced, but it does deal with the issue.
Fixes: e0c961bdaf27 (iio: adc: mxs-lradc: Prefer using the BIT macro)
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
Greg I guess the best bet might be if you pick this one up directly.
If not I can queue it up for a pull request that will probably hit
you on Sunday. Don't mind either way!
Jonathan
drivers/staging/iio/adc/mxs-lradc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 5f1375c465e6..bb1f15224ac8 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -319,7 +319,7 @@ struct mxs_lradc {
#define LRADC_CH_VALUE_OFFSET 0
#define LRADC_DELAY(n) (0xd0 + (0x10 * (n)))
-#define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24)
+#define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xffUL << 24)
#define LRADC_DELAY_TRIGGER_LRADCS_OFFSET 24
#define LRADC_DELAY_TRIGGER(x) \
(((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \
--
2.6.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging:iio:mxs-lradc Fix large integer implicitly truncated to unsigned warning
2015-12-02 18:24 [PATCH] staging:iio:mxs-lradc Fix large integer implicitly truncated to unsigned warning Jonathan Cameron
@ 2015-12-02 22:06 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-12-02 22:06 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, lars, maxime.ripard
On Wed, Dec 02, 2015 at 06:24:45PM +0000, Jonathan Cameron wrote:
> The change to using BIT(20) for one of the bit shifts resulted
> in a constant becoming unsigned. When combined with the existing
> signed constants in a couple of places, this caused possible trouble,
> hence the warnings:
>
> drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_complete_touch_event’:
> drivers/staging/iio/adc/mxs-lradc.c:325:5: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> (((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \
> ^
> drivers/staging/iio/adc/mxs-lradc.c:734:7: note: in expansion of macro ‘LRADC_DELAY_TRIGGER’
> LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) |
> ^
> LD [M] drivers/staging/iio/accel/adis16201.o
> drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_preenable’:
> drivers/staging/iio/adc/mxs-lradc.c:322:42: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> #define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24)
> ^
> drivers/staging/iio/adc/mxs-lradc.c:1308:29: note: in expansion of macro ‘LRADC_DELAY_TRIGGER_LRADCS_MASK’
> mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
> ^
> drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_postdisable’:
> drivers/staging/iio/adc/mxs-lradc.c:322:42: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> #define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24)
> ^
> drivers/staging/iio/adc/mxs-lradc.c:1327:29: note: in expansion of macro ‘LRADC_DELAY_TRIGGER_LRADCS_MASK’
> mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
>
> The simplest fix is to force LRADC_DELAY_TRIGGER_LRADCS_MASK to be
> a shift of an unsigned 0xff rather than a signed one.
>
> This is ugly considering it is the only constant in the driver which
> is so forced, but it does deal with the issue.
>
> Fixes: e0c961bdaf27 (iio: adc: mxs-lradc: Prefer using the BIT macro)
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
> ---
> Greg I guess the best bet might be if you pick this one up directly.
> If not I can queue it up for a pull request that will probably hit
> you on Sunday. Don't mind either way!
I've queued it up now, no need to wait.
thanks for the fix,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-02 22:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02 18:24 [PATCH] staging:iio:mxs-lradc Fix large integer implicitly truncated to unsigned warning Jonathan Cameron
2015-12-02 22:06 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.