[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1e05156120fdfd79ed267f44fe7f3491.sboyd@kernel.org>
Date: Tue, 21 Feb 2023 14:50:20 -0800
From: Stephen Boyd <sboyd@...nel.org>
To: Li zeming <zeming@...china.com>, michal.simek@...inx.com,
mturquette@...libre.com
Cc: linux-clk@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Li zeming <zeming@...china.com>
Subject: Re: [PATCH] zynq: clkc: Add kmalloc allocation flag
Quoting Li zeming (2023-02-22 13:58:34)
> The kmalloc could crash if allocation fails. Add the __GFP_NOFAIL flag
> to ensure that allocation succeeds every time.
>
> Signed-off-by: Li zeming <zeming@...china.com>
> ---
> drivers/clk/zynq/clkc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
> index 7bdeaff2bfd6..7621c2f00468 100644
> --- a/drivers/clk/zynq/clkc.c
> +++ b/drivers/clk/zynq/clkc.c
> @@ -427,7 +427,7 @@ static void __init zynq_clk_setup(struct device_node *np)
> SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock);
>
> tmp = strlen("mio_clk_00x");
> - clk_name = kmalloc(tmp, GFP_KERNEL);
> + clk_name = kmalloc(tmp, GFP_KERNEL | __GFP_NOFAIL);
There are so many more allocations happening in this function and they
aren't marked nofail. Why is this one special?
I could see a patch moving mio_clk_00x to the stack and then printing to
it. But it is also fine like this, so I don't see any reason to change
this.
Powered by blists - more mailing lists