Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 943efdef authored by David Dai's avatar David Dai
Browse files

clk: qcom: clk-debug: add null pointer checks for parent clocks



Add null pointer checks at places where clk_hw_get_parent is called
to prevent potential null dereferences.

Change-Id: I63af8ac64dd36c9310cadd94d26d48638c691252
Signed-off-by: default avatarDavid Dai <daidavid1@codeaurora.org>
parent 51e8260d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -295,6 +295,10 @@ static int clk_debug_read_period(void *data, u64 *val)
	ret = clk_find_and_set_parent(measure, hw);
	if (!ret) {
		parent = clk_hw_get_parent(measure);
		if (!parent) {
			mutex_unlock(&clk_debug_lock);
			return -EINVAL;
		}
		mux = to_clk_measure(parent);
		regmap_read(mux->regmap, mux->period_offset, &regval);
		if (!regval) {
@@ -339,6 +343,8 @@ void clk_debug_measure_add(struct clk_hw *hw, struct dentry *dentry)
	}

	parent = clk_hw_get_parent(measure);
	if (!parent)
		return;
	meas_parent = to_clk_measure(parent);

	if (parent->init->flags & CLK_IS_MEASURE && !meas_parent->mux_sels) {