1 From 491c6fbbe8fadead32fbe316fd5d0f21e9aa01f2 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 22 Apr 2021 10:45:37 +0200
4 Subject: [PATCH] clk: requests: Dereference the request pointer after
7 The current code will first dereference the req pointer and then test if
8 it's NULL, resulting in a NULL pointer dereference if req is indeed
9 NULL. Reorder the test and derefence to avoid the issue
11 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
13 drivers/clk/clk.c | 3 ++-
14 1 file changed, 2 insertions(+), 1 deletion(-)
16 --- a/drivers/clk/clk.c
17 +++ b/drivers/clk/clk.c
18 @@ -2496,10 +2496,11 @@ EXPORT_SYMBOL_GPL(clk_request_start);
20 void clk_request_done(struct clk_request *req)
22 - struct clk_core *core = req->clk->core;
23 + struct clk_core *core;
27 + core = req->clk->core;