Skip to content

Commit e962f13

Browse files
Dan Carpenterlag-linaro
authored andcommitted
backlight: mp3309c: Fix signedness bug in mp3309c_parse_fwnode()
The "num_levels" variable is used to store error codes from device_property_count_u32() so it needs to be signed. This doesn't cause an issue at runtime because devm_kcalloc() won't allocate negative sizes. However, it's still worth fixing. Fixes: b54c828 ("backlight: mp3309c: Make use of device properties") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Tested-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/74347f67-360d-4513-8939-595e3c4764fa@moroto.mountain Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 13cb61b commit e962f13

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/video/backlight/mp3309c.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,9 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip,
205205
struct mp3309c_platform_data *pdata)
206206
{
207207
int ret, i;
208-
unsigned int num_levels, tmp_value;
208+
unsigned int tmp_value;
209209
struct device *dev = chip->dev;
210+
int num_levels;
210211

211212
if (!dev_fwnode(dev))
212213
return dev_err_probe(dev, -ENODEV, "failed to get firmware node\n");

0 commit comments

Comments
 (0)