Re: [PATCH] regmap: Fix 'ret' would return an uninitialized value

Levente Kurusa
2013-11-15T13:28:02Z

2013-11-15 14:00 keltezéssel, Geyslan Gregório Bem írta:
> 2013/11/15 Caizhiyong <caizhiyong@hisilicon.com>:
>> From: Cai Zhiyong <caizhiyong@huawei.com>
>> Date: Mon, 11 Nov 2013 19:26:14 +0800
>> Subject: [PATCH] regmap: Fix 'ret' would return an uninitialized value
>>
>> This patch give a warning when calling regmap_register_patch with
>> parameter num_regs <= 0.
>>
>> When the num_regs parameter is zero and krealloc doesn't fail,
>> then the code would return an uninitialized value. However,
>> calling this function with num_regs == 0, would be a waste as it
>> essentially does nothing.
>>
>> Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
> Reviewed-by: Geyslan G. Bem <geyslan@gmail.com>
>
> Seems a good approach.
>

The patch doesn't apply. After manually applying this it
threw a compilation error:

drivers/base/regmap/regmap.c: In function ‘regmap_register_patch’:
drivers/base/regmap/regmap.c:2176:6: error: expected expression before ‘)’ token

Cai,
You have missed the second parameter of WARN_ONCE().
Please append what you'd prefer to have outputten once the condition evaluates to true.

--
Regards,
Levente Kurusa