diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-07-21 15:11:59 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-27 14:27:53 +0200 |
commit | 67fb0cc02f89049e532b008faa35818c82aa0d62 (patch) | |
tree | 2d4890d3ea814982bd29c0626a6cc16902c0a77b /drivers | |
parent | 0c25bab1abb43dbe2662e88f56e157ccac76f8c2 (diff) | |
download | linux-67fb0cc02f89049e532b008faa35818c82aa0d62.tar.bz2 |
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: fe6d8a9c8e64 ("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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/typec/anx7411.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c index 18a6a6a8b9eb..e16c2d511e8f 100644 --- a/drivers/usb/typec/anx7411.c +++ b/drivers/usb/typec/anx7411.c @@ -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; |