bus: mhi: core: Fix check for syserr at power_up
authorJeffrey Hugo <jhugo@codeaurora.org>
Fri, 12 Feb 2021 21:27:23 +0000 (14:27 -0700)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Wed, 10 Mar 2021 14:41:22 +0000 (20:11 +0530)
The check to see if we have reset the device after detecting syserr at
power_up is inverted.  wait_for_event_timeout() returns 0 on failure,
and a positive value on success.  The check is looking for non-zero
as a failure, which is likely to incorrectly cause a device init failure
if syserr was detected at power_up.  Fix this.

Fixes: e18d4e9fa79b ("bus: mhi: core: Handle syserr during power_up")
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/1613165243-23359-1-git-send-email-jhugo@codeaurora.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/bus/mhi/core/pm.c

index b4ee9295e7affa1a02f297033c6e9f30582c7688..adb0e80974f1f2610330ba1d515ea1703c4b9097 100644 (file)
@@ -1101,7 +1101,7 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
                                                           &val) ||
                                        !val,
                                msecs_to_jiffies(mhi_cntrl->timeout_ms));
-               if (ret) {
+               if (!ret) {
                        ret = -EIO;
                        dev_info(dev, "Failed to reset MHI due to syserr state\n");
                        goto error_bhi_offset;