* [PATCHv2] clk: hisilicon: clkdivider-hi6220: use kzalloc_flex
@ 2026-03-30 21:02 Rosen Penev
2026-03-31 14:12 ` Brian Masney
2026-03-31 21:44 ` kernel test robot
0 siblings, 2 replies; 4+ messages in thread
From: Rosen Penev @ 2026-03-30 21:02 UTC (permalink / raw)
To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, open list
Combine allocations using kzalloc_flex and a flexible array member.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
v2: add missing transformation.
drivers/clk/hisilicon/clkdivider-hi6220.c | 26 ++++++++---------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
index 1787ecefe601..b35c02d3bc05 100644
--- a/drivers/clk/hisilicon/clkdivider-hi6220.c
+++ b/drivers/clk/hisilicon/clkdivider-hi6220.c
@@ -26,8 +26,8 @@
* @shift: shift to the divider bit field
* @width: width of the divider bit field
* @mask: mask for setting divider rate
- * @table: the div table that the divider supports
* @lock: register lock
+ * @->table: the div table that the divider supports
*/
struct hi6220_clk_divider {
struct clk_hw hw;
@@ -35,8 +35,8 @@ struct hi6220_clk_divider {
u8 shift;
u8 width;
u32 mask;
- const struct clk_div_table *table;
spinlock_t *lock;
+ struct clk_div_table table[];
};
#define to_hi6220_clk_divider(_hw) \
@@ -108,24 +108,19 @@ struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
u32 max_div, min_div;
int i;
- /* allocate the divider */
- div = kzalloc_obj(*div);
- if (!div)
- return ERR_PTR(-ENOMEM);
-
/* Init the divider table */
max_div = div_mask(width) + 1;
min_div = 1;
- table = kzalloc_objs(*table, max_div + 1);
- if (!table) {
- kfree(div);
+ /* allocate the divider */
+ div = kzalloc_flex(*div, table, max_div + 1);
+ if (!div)
return ERR_PTR(-ENOMEM);
- }
for (i = 0; i < max_div; i++) {
- table[i].div = min_div + i;
- table[i].val = table[i].div - 1;
+ table = &div->table[i];
+ table->div = min_div + i;
+ table->val = table->div - 1;
}
init.name = name;
@@ -141,14 +136,11 @@ struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
div->mask = mask_bit ? BIT(mask_bit) : 0;
div->lock = lock;
div->hw.init = &init;
- div->table = table;
/* register the clock */
clk = clk_register(dev, &div->hw);
- if (IS_ERR(clk)) {
- kfree(table);
+ if (IS_ERR(clk))
kfree(div);
- }
return clk;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCHv2] clk: hisilicon: clkdivider-hi6220: use kzalloc_flex
2026-03-30 21:02 [PATCHv2] clk: hisilicon: clkdivider-hi6220: use kzalloc_flex Rosen Penev
@ 2026-03-31 14:12 ` Brian Masney
2026-03-31 21:48 ` Rosen Penev
2026-03-31 21:44 ` kernel test robot
1 sibling, 1 reply; 4+ messages in thread
From: Brian Masney @ 2026-03-31 14:12 UTC (permalink / raw)
To: Rosen Penev; +Cc: linux-clk, Michael Turquette, Stephen Boyd, open list
On Mon, Mar 30, 2026 at 02:02:17PM -0700, Rosen Penev wrote:
> Combine allocations using kzalloc_flex and a flexible array member.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> v2: add missing transformation.
> drivers/clk/hisilicon/clkdivider-hi6220.c | 26 ++++++++---------------
> 1 file changed, 9 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
> index 1787ecefe601..b35c02d3bc05 100644
> --- a/drivers/clk/hisilicon/clkdivider-hi6220.c
> +++ b/drivers/clk/hisilicon/clkdivider-hi6220.c
> @@ -26,8 +26,8 @@
> * @shift: shift to the divider bit field
> * @width: width of the divider bit field
> * @mask: mask for setting divider rate
> - * @table: the div table that the divider supports
> * @lock: register lock
> + * @->table: the div table that the divider supports
Why this change?
Brian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] clk: hisilicon: clkdivider-hi6220: use kzalloc_flex
2026-03-31 14:12 ` Brian Masney
@ 2026-03-31 21:48 ` Rosen Penev
0 siblings, 0 replies; 4+ messages in thread
From: Rosen Penev @ 2026-03-31 21:48 UTC (permalink / raw)
To: Brian Masney; +Cc: linux-clk, Michael Turquette, Stephen Boyd, open list
On Tue, Mar 31, 2026 at 7:12 AM Brian Masney <bmasney@redhat.com> wrote:
>
> On Mon, Mar 30, 2026 at 02:02:17PM -0700, Rosen Penev wrote:
> > Combine allocations using kzalloc_flex and a flexible array member.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> > v2: add missing transformation.
> > drivers/clk/hisilicon/clkdivider-hi6220.c | 26 ++++++++---------------
> > 1 file changed, 9 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
> > index 1787ecefe601..b35c02d3bc05 100644
> > --- a/drivers/clk/hisilicon/clkdivider-hi6220.c
> > +++ b/drivers/clk/hisilicon/clkdivider-hi6220.c
> > @@ -26,8 +26,8 @@
> > * @shift: shift to the divider bit field
> > * @width: width of the divider bit field
> > * @mask: mask for setting divider rate
> > - * @table: the div table that the divider supports
> > * @lock: register lock
> > + * @->table: the div table that the divider supports
>
> Why this change?
Guess I monkey fingered this in vim... I just wanted ddjp
>
> Brian
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] clk: hisilicon: clkdivider-hi6220: use kzalloc_flex
2026-03-30 21:02 [PATCHv2] clk: hisilicon: clkdivider-hi6220: use kzalloc_flex Rosen Penev
2026-03-31 14:12 ` Brian Masney
@ 2026-03-31 21:44 ` kernel test robot
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-31 21:44 UTC (permalink / raw)
To: Rosen Penev, linux-clk
Cc: oe-kbuild-all, Michael Turquette, Stephen Boyd, linux-kernel
Hi Rosen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on clk/clk-next]
[also build test WARNING on linus/master v7.0-rc6 next-20260330]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/clk-hisilicon-clkdivider-hi6220-use-kzalloc_flex/20260331-195943
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
patch link: https://lore.kernel.org/r/20260330210217.11168-1-rosenp%40gmail.com
patch subject: [PATCHv2] clk: hisilicon: clkdivider-hi6220: use kzalloc_flex
config: arm64-randconfig-002-20260401 (https://download.01.org/0day-ci/archive/20260401/202604010519.tShwh1pt-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260401/202604010519.tShwh1pt-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604010519.tShwh1pt-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> Warning: drivers/clk/hisilicon/clkdivider-hi6220.c:39 struct member 'table' not described in 'hi6220_clk_divider'
>> Warning: drivers/clk/hisilicon/clkdivider-hi6220.c:39 struct member 'table' not described in 'hi6220_clk_divider'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-31 21:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 21:02 [PATCHv2] clk: hisilicon: clkdivider-hi6220: use kzalloc_flex Rosen Penev
2026-03-31 14:12 ` Brian Masney
2026-03-31 21:48 ` Rosen Penev
2026-03-31 21:44 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox