Linux USB
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Xin Ji <xji@analogixsemi.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] usb: typec: anx7411: Fix error code in anx7411_register_partner()
Date: Thu, 28 Jul 2022 10:13:16 +0300	[thread overview]
Message-ID: <YuI3DBkC983Y3oZn@kili> (raw)

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

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


             reply	other threads:[~2022-07-28  7:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28  7:13 Dan Carpenter [this message]
2022-07-28  7:22 ` [PATCH] usb: typec: anx7411: Fix error code in anx7411_register_partner() Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YuI3DBkC983Y3oZn@kili \
    --to=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=xji@analogixsemi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox