mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
usb: typec: anx7411: fix passing zero to 'PTR_ERR'
Fix anx7411_register_partner() warn: passing zero to 'PTR_ERR'
Fixes: fe6d8a9c8e
("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>
This commit is contained in:
parent
d183a57cad
commit
23bb7b4959
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user