Quoting Binbin Zhou (2025-01-09 03:30:04) > diff --git a/drivers/clk/clk-loongson2.c b/drivers/clk/clk-loongson2.c > index 6bf51d5a49a1..9c240a2308f5 100644 > --- a/drivers/clk/clk-loongson2.c > +++ b/drivers/clk/clk-loongson2.c > @@ -294,7 +294,7 @@ static int loongson2_clk_probe(struct platform_device *pdev) > return -EINVAL; > > for (p = data; p->name; p++) > - clks_num++; > + clks_num = max(clks_num, p->id + 1); > > clp = devm_kzalloc(dev, struct_size(clp, clk_data.hws, clks_num), > GFP_KERNEL); > @@ -309,6 +309,9 @@ static int loongson2_clk_probe(struct platform_device *pdev) > clp->clk_data.num = clks_num; > clp->dev = dev; > > + /* Avoid returning NULL for unused id */ > + memset_p((void **)&clp->clk_data.hws, ERR_PTR(-ENOENT), clks_num); This looks wrong. It's already an array of pointers, i.e. the type is 'struct clk_hw *[]' or 'struct clk_hw **' so we shouldn't need to take the address of it. Should it be memset_p((void **)clkp->clk_data.hws, ERR_PTR(-ENOENT), clks_num); ? It's unfortunate that we have to cast here, but I guess this is the best way we can indicate that the type should be an array of pointers.