[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220722081836.3380885-1-xji@analogixsemi.com>
Date: Fri, 22 Jul 2022 16:18:34 +0800
From: Xin Ji <xji@...logixsemi.com>
To: Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Xin Ji <xji@...logixsemi.com>
Cc: bliang@...logixsemi.com, qwen@...logixsemi.com,
jli@...logixsemi.com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] usb: typec: anx7411: fix passing zero to 'PTR_ERR'
Fix anx7411_register_partner() warn: passing zero to 'PTR_ERR'
Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Xin Ji <xji@...logixsemi.com>
---
drivers/usb/typec/anx7411.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index b990376991f8..7b45d7440a9d 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;
+ struct typec_partner *partner;
if (ctx->typec.partner)
return 0;
@@ -381,11 +382,11 @@ static int anx7411_register_partner(struct anx7411_data *ctx,
desc.usb_pd = pd;
desc.accessory = accessory;
desc.identity = NULL;
- ctx->typec.partner = typec_register_partner(ctx->typec.port, &desc);
- if (IS_ERR(ctx->typec.partner)) {
- ctx->typec.partner = NULL;
- return PTR_ERR(ctx->typec.partner);
- }
+ partner = typec_register_partner(ctx->typec.port, &desc);
+ if (IS_ERR(partner))
+ return PTR_ERR(partner);
+
+ ctx->typec.partner = partner;
return 0;
}
--
2.25.1
Powered by blists - more mailing lists