lkml.org 
[lkml]   [2023]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] zynq: clkc: Add kmalloc allocation flag
Date
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@nfschina.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);
for (i = 0; i < NUM_MIO_PINS; i++) {
int idx;

--
2.18.2
\
 
 \ /
  Last update: 2023-03-27 00:29    [W:0.028 / U:6.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site