Skip to contentSkip to conversation

bus: mhi: core: Add missing checks for MMIO register entries

PATCH Superseded Bhaumik Bhatt 1 participant 1 message Mar 2, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus: mhi: core: Add missing checks for MMIO register entries

As per documentation, fields marked as (required) in an MHI controller structure need to be populated by the controller driver before calling mhi_register_controller(). Ensure all required fields are present in the controller before proceeding with the registration.

---
 drivers/bus/mhi/core/init.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/bus/mhi/core/init.c +4 -4
index aa575d3..33323ad 100644
@@ -860,10 +860,10 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,
 	u32 soc_info;
 	int ret, i;
 
-	if (!mhi_cntrl)
-		return -EINVAL;
-
-	if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
+	if (!mhi_cntrl || !mhi_cntrl->cntrl_dev || !mhi_cntrl->regs ||
+	    !mhi_cntrl->iova_start || !mhi_cntrl->iova_stop ||
+	    !mhi_cntrl->fw_image || !mhi_cntrl->irq ||
+	    !mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
 	    !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||
 	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs)
 		return -EINVAL;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project