diff mbox series

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

Message ID YuI3DBkC983Y3oZn@kili (mailing list archive)
State New, archived
Headers show
Series usb: typec: anx7411: Fix error code in anx7411_register_partner() | expand

Commit Message

Dan Carpenter July 28, 2022, 7:13 a.m. UTC
This code accidentally return success instead of a negative error code.

Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/usb/typec/anx7411.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Greg KH July 28, 2022, 7:22 a.m. UTC | #1
On Thu, Jul 28, 2022 at 10:13:16AM +0300, Dan Carpenter wrote:
> This code accidentally return success instead of a negative error code.
> 
> Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  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
diff mbox series

Patch

diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index b990376991f8..96a3bf96f35e 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -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;