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@xxxxxxxxxx> --- drivers/usb/typec/anx7411.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.35.1