Skip to content

Commit

Permalink
usb: typec: anx7411: Fix wrong pointer passed to PTR_ERR()
Browse files Browse the repository at this point in the history
It should be 'ctx->typec.amode[i]' passed to PTR_ERR() when
typec_partner_register_altmode() failed.

Fixes: fe6d8a9 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220721071201.269344-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Yang Yingliang authored and Greg Kroah-Hartman committed Jul 27, 2022
1 parent 0c25bab commit 67fb0cc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/typec/anx7411.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ static int anx7411_typec_register_altmode(struct anx7411_data *ctx,
{
struct device *dev = &ctx->spi_client->dev;
struct typec_altmode_desc desc;
int err;
int i;

desc.svid = svid;
Expand All @@ -569,8 +570,9 @@ static int anx7411_typec_register_altmode(struct anx7411_data *ctx,
&desc);
if (IS_ERR(ctx->typec.amode[i])) {
dev_err(dev, "failed to register altmode\n");
err = PTR_ERR(ctx->typec.amode[i]);
ctx->typec.amode[i] = NULL;
return PTR_ERR(ctx->typec.amode);
return err;
}

return 0;
Expand Down

0 comments on commit 67fb0cc

Please sign in to comment.