diff mbox series

[v1,3/6] bus: mhi: core: Check for RDDM support before forcing a device crash

Message ID 1589934631-22752-4-git-send-email-bbhatt@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series Bug fixes and bootup and shutdown improvements | expand

Commit Message

Bhaumik Bhatt May 20, 2020, 12:30 a.m. UTC
Check if the device supports RDDM from the mhi_force_rddm_mode() API
before allowing a client to force a device crash. This will ensure that
a client who is unaware does not misuse the API and expect the device to
go to ramdump collection mode after a crash is forced.

Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
---
 drivers/bus/mhi/core/pm.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
index 1daed86..52c290c6 100644
--- a/drivers/bus/mhi/core/pm.c
+++ b/drivers/bus/mhi/core/pm.c
@@ -1114,6 +1114,10 @@  int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl)
 	struct device *dev = &mhi_cntrl->mhi_dev->dev;
 	int ret;
 
+	/* Check if device supports RDDM */
+	if (!mhi_cntrl->rddm_image)
+		return -EINVAL;
+
 	/* Check if device is already in RDDM */
 	if (mhi_cntrl->ee == MHI_EE_RDDM)
 		return 0;