Re: [PATCH v3 05/15] bus: ts-nbus: use bitmap_get_value8()

From: David Lechner
Date: Thu Feb 20 2025 - 12:21:26 EST


On 2/20/25 6:06 AM, Andy Shevchenko wrote:
> On Thu, Feb 20, 2025 at 12:17 PM Simon Horman <horms@xxxxxxxxxx> wrote:
>> On Mon, Feb 10, 2025 at 04:33:31PM -0600, David Lechner wrote:
>
> ...
>
>> But when compiling with GCC 14.2.0 I see warnings that values
>> is used uninitialised - bitmap_set_value8() appears to rely on
>> it being so.
>
>> In file included from drivers/bus/ts-nbus.c:13:
>> In function ‘bitmap_write’,
>> inlined from ‘ts_nbus_reset_bus’ at drivers/bus/ts-nbus.c:111:2:
>> ./include/linux/bitmap.h:818:12: error: ‘values’ is used uninitialized [-Werror=uninitialized]
>> 818 | map[index] &= (fit ? (~(mask << offset)) : ~BITMAP_FIRST_WORD_MASK(start));
>> | ~~~^~~~~~~
>
> Heh, the compiler is dumb. Even if it's not initialised we do not care.
>
> ...
>
> Wondering if the bitmap_write() will work better...
>

It is already using that:

#define bitmap_set_value8(map, value, start) \
bitmap_write(map, value, start, BITS_PER_BYTE)