regmap: Fix 'ret' would return an uninitialized value
authorCai Zhiyong <caizhiyong@huawei.com>
Mon, 18 Nov 2013 12:21:49 +0000 (20:21 +0800)
committerMark Brown <broonie@linaro.org>
Sun, 24 Nov 2013 13:59:14 +0000 (13:59 +0000)
commitbd60e381fab88979c3312265d18bb635c314d242
tree7f0d6878610b05f49a6414a943b9fa4118d40f23
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae
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>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/base/regmap/regmap.c