lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220722081836.3380885-2-xji@analogixsemi.com>
Date:   Fri, 22 Jul 2022 16:18:35 +0800
From:   Xin Ji <xji@...logixsemi.com>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Xin Ji <xji@...logixsemi.com>
Cc:     bliang@...logixsemi.com, qwen@...logixsemi.com,
        jli@...logixsemi.com, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] usb: typec: anx7411: fix passing a valid pointer to 'PTR_ERR'

Fix anx7411_typec_register_altmode() warn: passing a valid pointer to
'PTR_ERR'.

Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Xin Ji <xji@...logixsemi.com>
---
 drivers/usb/typec/anx7411.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index 7b45d7440a9d..dc86b6704cbd 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -550,6 +550,7 @@ static int anx7411_typec_register_altmode(struct anx7411_data *ctx,
 {
 	struct device *dev = &ctx->spi_client->dev;
 	struct typec_altmode_desc desc;
+	struct typec_altmode *alt;
 	int i;
 
 	desc.svid = svid;
@@ -566,14 +567,14 @@ static int anx7411_typec_register_altmode(struct anx7411_data *ctx,
 		return -ENOMEM;
 	}
 
-	ctx->typec.amode[i] = typec_partner_register_altmode(ctx->typec.partner,
-							     &desc);
-	if (IS_ERR(ctx->typec.amode[i])) {
+	alt = typec_partner_register_altmode(ctx->typec.partner, &desc);
+	if (IS_ERR(alt)) {
 		dev_err(dev, "failed to register altmode\n");
-		ctx->typec.amode[i] = NULL;
-		return PTR_ERR(ctx->typec.amode);
+		return PTR_ERR(alt);
 	}
 
+	ctx->typec.amode[i] = alt;
+
 	return 0;
 }
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ