summaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec/anx7411.c
diff options
context:
space:
mode:
authorXin Ji <xji@analogixsemi.com>2022-07-22 16:18:34 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-27 14:28:07 +0200
commit23bb7b49597139d38f4da9392df28a24229697b6 (patch)
tree6305d9bbbbf6afa79fa75dff3f6d00ea7dada010 /drivers/usb/typec/anx7411.c
parentd183a57cad920087a770c45721e98f45feea0fde (diff)
downloadlinux-stable-23bb7b49597139d38f4da9392df28a24229697b6.tar.gz
linux-stable-23bb7b49597139d38f4da9392df28a24229697b6.tar.bz2
linux-stable-23bb7b49597139d38f4da9392df28a24229697b6.zip
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@analogixsemi.com> Link: https://lore.kernel.org/r/20220722081836.3380885-1-xji@analogixsemi.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/anx7411.c')
-rw-r--r--drivers/usb/typec/anx7411.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index f8baa1e189b3..c0f0842d443c 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;
}