Skip to contentSkip to conversation

firmware: arm_scmi: remove some unnecessary checks

PATCH Applied Dan Carpenter 2 participants 2 messages May 19, 2018 – May 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: arm_scmi: remove some unnecessary checks

The "pi->dom_info" buffer is allocated in init() and it can't be NULL here. These tests are sort of weird as well because if "pi->dom_info" was NULL but "domain" was non-zero then it would lead to an Oops.

drivers/firmware/arm_scmi/perf.c +0 -5
index 2a219b1261b1..721e6c57beae 100644
@@ -363,8 +363,6 @@ static int scmi_dvfs_device_opps_add(const struct scmi_handle *handle,
 		return domain;
 
 	dom = pi->dom_info + domain;
-	if (!dom)
-		return -EIO;
 
 	for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) {
 		freq = opp->perf * dom->mult_factor;
@@ -394,9 +392,6 @@ static int scmi_dvfs_transition_latency_get(const struct scmi_handle *handle,
 		return domain;
 
 	dom = pi->dom_info + domain;
-	if (!dom)
-		return -EIO;
-
 	/* uS to nS */
 	return dom->opp[dom->opp_count - 1].trans_latency_us * 1000;
 }
Applied
#1 lore raw
Quoted 4 lines · Dan Carpenter

The "pi->dom_info" buffer is allocated in init() and it can't be NULL here. These tests are sort of weird as well because if "pi->dom_info" was NULL but "domain" was non-zero then it would lead to an Oops.

Indeed. Thanks for the patch.

Quoted 1 line

Applied.

Signature · 2 lines
Regards,
Sudeep