Skip to contentSkip to conversation

platform/chrome: typec: Fix ret value check error

PATCH In review Prashant Malani 2 participants 2 messages Apr 22, 2020

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

PATCH 1/1 platform/chrome: typec: Fix ret value check error

cros_typec_add_partner() returns 0 on success, so check for "ret" instead of "!ret" as an error.

Fixes 9d33ea331032 ("platform/chrome: cros_ec_typec: Register port partner")
---
 drivers/platform/chrome/cros_ec_typec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_typec.c +1 -1
index eda57db26f8d..66b8d21092af 100644
@@ -263,7 +263,7 @@ static void cros_typec_set_port_params_v1(struct cros_typec_data *typec,
 
 		pd_en = resp->enabled & PD_CTRL_RESP_ENABLED_PD_CAPABLE;
 		ret = cros_typec_add_partner(typec, port_num, pd_en);
-		if (!ret)
+		if (ret)
 			dev_warn(typec->dev,
 				 "Failed to register partner on port: %d\n",
 				 port_num);
Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
#1 lore raw

Hi Prashant,

Quoted 5 lines · Prashant Malani

cros_typec_add_partner() returns 0 on success, so check for "ret" instead of "!ret" as an error.

Fixes 9d33ea331032 ("platform/chrome: cros_ec_typec: Register port partner")

Thanks. Applied for 5.8.

origin/for-kernelci updated.

Thanks,
Benson

Quoted 20 lines
---
 drivers/platform/chrome/cros_ec_typec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_typec.c +1 -1
index eda57db26f8d..66b8d21092af 100644
@@ -263,7 +263,7 @@ static void cros_typec_set_port_params_v1(struct cros_typec_data *typec,
 
 		pd_en = resp->enabled & PD_CTRL_RESP_ENABLED_PD_CAPABLE;
 		ret = cros_typec_add_partner(typec, port_num, pd_en);
-		if (!ret)
+		if (ret)
 			dev_warn(typec->dev,
 				 "Failed to register partner on port: %d\n",
 				 port_num);
Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
Signature · 7 lines
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
[email protected]
Chromium OS Project
[email protected]