From: Ahmad Fatoum <[email protected]> The levels table is allocated with xzalloc(), but freed with devm_kfree() when it's replaced by the interpolated table. That only works as long as devm_kfree() is a plain free(), so allocate it with devm_kcalloc() like Linux does.
Assisted-by: Claude:fable-5.1 Signed-off-by: Ahmad Fatoum <[email protected]> --- drivers/video/backlight-pwm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/backlight-pwm.c b/drivers/video/backlight-pwm.c index 581fa0237c0f..4ec0f6fe5b23 100644 --- a/drivers/video/backlight-pwm.c +++ b/drivers/video/backlight-pwm.c @@ -127,9 +127,9 @@ static int pwm_backlight_parse_dt(struct device *dev, /* read brightness levels from DT property */ if (length > 0) { - size_t size = sizeof(*pwm_backlight->levels) * length; - - pwm_backlight->levels = xzalloc(size); + pwm_backlight->levels = devm_kcalloc(dev, length, + sizeof(*pwm_backlight->levels), + GFP_KERNEL); ret = of_property_read_u32_array(node, "brightness-levels", pwm_backlight->levels, -- 2.47.3
