[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220721071201.269344-1-yangyingliang@huawei.com>
Date: Thu, 21 Jul 2022 15:11:59 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>
CC: <heikki.krogerus@...ux.intel.com>, <gregkh@...uxfoundation.org>
Subject: [PATCH -next 1/3] 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@...wei.com>
---
drivers/usb/typec/anx7411.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index b990376991f8..1ffab17a9b17 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;
--
2.25.1
Powered by blists - more mailing lists