Skip to contentSkip to conversation

usb: typec: anx7411: Fix error code in anx7411_register_partner()

PATCH In review Dan Carpenter 2 participants 2 messages Jul 28, 2022

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

PATCH 1/1 usb: typec: anx7411: Fix error code in anx7411_register_partner()

This code accidentally return success instead of a negative error code.

Fixes fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
---
 drivers/usb/typec/anx7411.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/typec/anx7411.c +3 -1
index b990376991f8..96a3bf96f35e 100644
@@ -374,6 +374,7 @@ static int anx7411_register_partner(struct anx7411_data *ctx,
 				    int pd, int accessory)
 {
 	struct typec_partner_desc desc;
+	int ret;
 
 	if (ctx->typec.partner)
 		return 0;
@@ -383,8 +384,9 @@ static int anx7411_register_partner(struct anx7411_data *ctx,
 	desc.identity = NULL;
 	ctx->typec.partner = typec_register_partner(ctx->typec.port, &desc);
 	if (IS_ERR(ctx->typec.partner)) {
+		ret = PTR_ERR(ctx->typec.partner);
 		ctx->typec.partner = NULL;
-		return PTR_ERR(ctx->typec.partner);
+		return ret;
 	}
 
 	return 0;
Signature · 1 line
2.35.1
#1 lore raw
Quoted 7 lines · Dan Carpenter

This code accidentally return success instead of a negative error code.

Fixes fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
---
 drivers/usb/typec/anx7411.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Doesn't apply to my tree anymore, I think this is already fixed. Let me push it out so it shows up in linux-next tomorrow.

thanks,

greg k-h