Commit 67fb0cc0 authored by Yang Yingliang's avatar Yang Yingliang Committed by Greg Kroah-Hartman

usb: typec: anx7411: Fix wrong pointer passed to PTR_ERR()

It should be 'ctx->typec.amode[i]' passed to PTR_ERR() when
typec_partner_register_altmode() failed.

Fixes: fe6d8a9c ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220721071201.269344-1-yangyingliang@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0c25bab1
......@@ -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;
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment