On 29/6/23 16:07, Uwe Kleine-König wrote:
On Thu, Jun 29, 2023 at 01:12:25PM +0200, Paul Cercueil wrote:
Le 29 juin 2023 11:48, Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> a écrit :
Stop using chip_data which is about to go away. Instead track the
per-channel clk in struct jz4740_pwm_chip.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
drivers/pwm/pwm-jz4740.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
@@ -229,7 +231,8 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
if (!info)
return -EINVAL;
- jz4740 = devm_kzalloc(dev, sizeof(*jz4740), GFP_KERNEL);
+ jz4740 = devm_kzalloc(dev, sizeof(*jz4740) + info->num_pwms * sizeof(jz4740->clk[0]),
+ GFP_KERNEL);
LGTM, but please use struct_size() from <linux/overflow.h>.
Ah, I thought there is such a macro, but I didn't find it neither by
grepping nor by asking in #kernelnewbies. Thanks, will respin the series
in a few days.
Oh, TIL too :) R-b stands in respin.