File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -263,9 +263,8 @@ static int pwm_backlight_parse_dt(struct device *dev,
263
263
264
264
/* read brightness levels from DT property */
265
265
if (num_levels > 0 ) {
266
- size_t size = sizeof (* data -> levels ) * num_levels ;
267
-
268
- data -> levels = devm_kzalloc (dev , size , GFP_KERNEL );
266
+ data -> levels = devm_kcalloc (dev , num_levels ,
267
+ sizeof (* data -> levels ), GFP_KERNEL );
269
268
if (!data -> levels )
270
269
return - ENOMEM ;
271
270
@@ -320,8 +319,8 @@ static int pwm_backlight_parse_dt(struct device *dev,
320
319
* Create a new table of brightness levels with all the
321
320
* interpolated steps.
322
321
*/
323
- size = sizeof (* table ) * num_levels ;
324
- table = devm_kzalloc ( dev , size , GFP_KERNEL );
322
+ table = devm_kcalloc ( dev , num_levels , sizeof (* table ),
323
+ GFP_KERNEL );
325
324
if (!table )
326
325
return - ENOMEM ;
327
326
/*
You can’t perform that action at this time.
0 commit comments