Skip to contentSkip to conversation

bus: mhi: core: Fix check for syserr at power_up

PATCH Applied Jeffrey Hugo 4 participants 5 messages Feb 12, 2021 – May 26, 2021

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

PATCH 1/1 bus: mhi: core: Fix check for syserr at power_up

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")
---
 drivers/bus/mhi/core/pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/core/pm.c +1 -1
index 681960c..36ab7aa 100644
@@ -1092,7 +1092,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;
Signature · 2 lines
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jeffrey Hugo

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")
Quoted 21 lines
---
 drivers/bus/mhi/core/pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/core/pm.c +1 -2
index 681960c..36ab7aa 100644
@@ -1092,7 +1092,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;
--

Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jeffrey Hugo
Quoted 8 lines · Jeffrey Hugo

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")

Thanks,
Mani

Quoted 21 lines
---
 drivers/bus/mhi/core/pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/core/pm.c +1 -1
index 681960c..36ab7aa 100644
@@ -1092,7 +1092,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;
Signature · 2 lines
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#3 lore raw
In reply to Jeffrey Hugo
Quoted 8 lines · Jeffrey Hugo

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")

Applied to mhi-next!

Thanks,
Mani

Quoted 21 lines
---
 drivers/bus/mhi/core/pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/core/pm.c +1 -1
index 681960c..36ab7aa 100644
@@ -1092,7 +1092,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;
Signature · 2 lines
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#4 lore raw
In reply to Jeffrey Hugo
This patch was applied to qcom/linux.git (refs/heads/for-next):

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

Quoted 10 lines · On Fri, 12 Feb 2021 14:27:23 -0700 you wrote:

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")

[...]

Here is the summary with links:
- bus: mhi: core: Fix check for syserr at power_up

    https://git.kernel.org/qcom/c/6403298c58d4

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html