Commit 0a47e5e8 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Uwe Kleine-König
Browse files

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: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarJulia Lawall <julia.lawall@inria.fr>
Closes: https://lore.kernel.org/r/202510301753.iqGmTwae-lkp@intel.com/


Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20251030222528.632836-2-u.kleine-koenig@baylibre.com


Signed-off-by: default avatarUwe Kleine-König <ukleinek@kernel.org>
parent a875806e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -444,7 +444,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
	soc = of_device_get_match_data(&pdev->dev);

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