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

Commit d886ace2 authored by Odelu Kukatla's avatar Odelu Kukatla Committed by Gerrit - the friendly Code Review server
Browse files

clk: msm: clock-cpu: Avoid NULL pointer dereference



Check for NULL and return error to avoid the NULL pointer
derefernce.

Change-Id: I3733020ea41ac1421327699aeb1bf9387987fa6a
Signed-off-by: default avatarOdelu Kukatla <okukatla@codeaurora.org>
parent f5c48058
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -489,6 +489,11 @@ static int add_opp(struct clk *c, struct device *cpudev, struct device *vregdev,
	struct dev_pm_opp *oppl;
	int j = 1;

	if (!cpudev) {
		pr_warn("clock-cpu: NULL CPU device\n");
		return -ENODEV;
	}

	rcu_read_lock();
	/* Check if the regulator driver has already populated OPP tables */
	oppl = dev_pm_opp_find_freq_exact(vregdev, 2, true);
+5 −0
Original line number Diff line number Diff line
@@ -499,6 +499,11 @@ static int add_opp(struct clk *c, struct device *dev, unsigned long max_rate)
	bool first = true;
	int j = 1;

	if (!dev) {
		pr_warn("clock-cpu: NULL CPU device\n");
		return -ENODEV;
	}

	while (1) {
		rate = c->fmax[j++];
		level = find_vdd_level(c, rate);
+5 −0
Original line number Diff line number Diff line
@@ -686,6 +686,11 @@ static int add_opp(struct clk *c, struct device *cpudev,
	long ret, uv, corner;
	int j = 1;

	if (!cpudev) {
		pr_warn("clock-cpu: NULL CPU device\n");
		return -ENODEV;
	}

	while (1) {
		rate = c->fmax[j++];