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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHadaACH8Mq/10F7@mwanda>
Date:   Wed, 14 Apr 2021 10:44:40 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] usb: typec: silence a static checker warning

Smatch complains about a potential missing error code:

    drivers/usb/typec/port-mapper.c:168 typec_link_port()
    warn: missing error code 'ret'

This is a false positive and returning zero is intentional.  Let's
re-arrange the code to silence the warning and make the intent more
clear.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
 drivers/usb/typec/port-mapper.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c
index fae736eb0601..9b0991bdf391 100644
--- a/drivers/usb/typec/port-mapper.c
+++ b/drivers/usb/typec/port-mapper.c
@@ -157,15 +157,17 @@ int typec_link_port(struct device *port)
 {
 	struct device *connector;
 	struct port_node *node;
-	int ret = 0;
+	int ret;
 
 	node = create_port_node(port);
 	if (IS_ERR(node))
 		return PTR_ERR(node);
 
 	connector = find_connector(node);
-	if (!connector)
+	if (!connector) {
+		ret = 0;
 		goto remove_node;
+	}
 
 	ret = link_port(to_typec_port(connector), node);
 	if (ret)
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ