clk: imx: Add correct failure handling for clk based helpers
authorAbel Vesa <abel.vesa@nxp.com>
Wed, 11 Dec 2019 09:25:40 +0000 (11:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:34 +0000 (08:36 +0100)
commit4ece124849a20433dedadbc9b2fa7666b03b00ba
treed5646ef5bec67d954f8d7a97623b0a61c0744484
parent0685dfa0a2ff7635c0b64f7b7f0fafbf1c3e0c14
clk: imx: Add correct failure handling for clk based helpers

[ Upstream commit f60f1c62c3188fcca945581e35e3440ee3fdcc95 ]

If the clk_hw based API returns an error, trying to return the clk from
hw will end up in a NULL pointer dereference. So adding the to_clk
checker and using it inside every clk based macro helper we handle that
case correctly.

This to_clk is also temporary and will go away along with the clk based
macro helpers once there is no user that need them anymore.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/imx/clk.h