Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference

of_clk_get_from_provider() returns ERR_PTR on failure. The
dra7-atl-clock driver was not checking its return value and
immediately used it in __clk_get_hw(). __clk_get_hw()
dereferences supplied clock, if it is not NULL, so in that case
it would dereference an ERR_PTR.

Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Krzysztof Kozlowski and committed by
Stephen Boyd
e0cdcda5 beb7a2a9

+5
+5
drivers/clk/ti/clk-dra7-atl.c
··· 252 252 } 253 253 254 254 clk = of_clk_get_from_provider(&clkspec); 255 + if (IS_ERR(clk)) { 256 + pr_err("%s: failed to get atl clock %d from provider\n", 257 + __func__, i); 258 + return PTR_ERR(clk); 259 + } 255 260 256 261 cdesc = to_atl_desc(__clk_get_hw(clk)); 257 262 cdesc->cinfo = cinfo;