Skip to content

Commit 0a47e5e

Browse files
ukleinekUwe Kleine-König
authored andcommitted
pwm: mediatek: Make use of struct_size macro
struct_size provides the size of a struct with a flexible array member. Use that instead of open-coding it (with less checks than the global macro). Reported-by: kernel test robot <lkp@intel.com> Reported-by: Julia Lawall <julia.lawall@inria.fr> Closes: https://lore.kernel.org/r/202510301753.iqGmTwae-lkp@intel.com/ Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20251030222528.632836-2-u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
1 parent a875806 commit 0a47e5e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/pwm/pwm-mediatek.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
444444
soc = of_device_get_match_data(&pdev->dev);
445445

446446
chip = devm_pwmchip_alloc(&pdev->dev, soc->num_pwms,
447-
sizeof(*pc) + soc->num_pwms * sizeof(*pc->clk_pwms));
447+
struct_size(pc, clk_pwms, soc->num_pwms));
448448
if (IS_ERR(chip))
449449
return PTR_ERR(chip);
450450
pc = to_pwm_mediatek_chip(chip);

0 commit comments

Comments
 (0)