Commit cec4a609 authored by Tero Kristo's avatar Tero Kristo Committed by Stephen Boyd
Browse files

clk: ti: autoidle: add checks against NULL pointer reference



The clk pointer passed to omap2_clk_(deny|allow)_idle can be NULL, so
add checks for this.

Reported-by: default avatarDan Murphy <dmurphy@ti.com>
Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
Link: https://lore.kernel.org/r/20200907082600.454-2-t-kristo@ti.com


Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 4630ef13
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -82,7 +82,12 @@ static int _omap2_clk_allow_idle(struct clk_hw_omap *clk)
 */
int omap2_clk_deny_idle(struct clk *clk)
{
	struct clk_hw *hw = __clk_get_hw(clk);
	struct clk_hw *hw;

	if (!clk)
		return -EINVAL;

	hw = __clk_get_hw(clk);

	if (omap2_clk_is_hw_omap(hw)) {
		struct clk_hw_omap *c = to_clk_hw_omap(hw);
@@ -101,7 +106,12 @@ int omap2_clk_deny_idle(struct clk *clk)
 */
int omap2_clk_allow_idle(struct clk *clk)
{
	struct clk_hw *hw = __clk_get_hw(clk);
	struct clk_hw *hw;

	if (!clk)
		return -EINVAL;

	hw = __clk_get_hw(clk);

	if (omap2_clk_is_hw_omap(hw)) {
		struct clk_hw_omap *c = to_clk_hw_omap(hw);