Skip to content

Commit

Permalink
usb: typec: silence a static checker warning
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YHadaACH8Mq/10F7@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Apr 14, 2021
1 parent 401411b commit 434438d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/usb/typec/port-mapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 434438d

Please sign in to comment.