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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YGGUU2z0qHsfgKrV@kroah.com>
Date:   Mon, 29 Mar 2021 10:48:19 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc:     Alan Stern <stern@...land.harvard.edu>,
        Benson Leung <bleung@...gle.com>,
        Prashant Malani <pmalani@...omium.org>,
        Guenter Roeck <linux@...ck-us.net>, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 6/6] usb: typec: Link all ports during connector
 registration

On Mon, Mar 29, 2021 at 11:44:26AM +0300, Heikki Krogerus wrote:
> +#ifdef CONFIG_USB

This feels odd in a file under drivers/usb/ is it still relevant?  Will
this code get built for non-USB systems (i.e. gadget only?)

> +static int each_port(struct device *port, void *connector)
> +{
> +	struct port_node *node;
> +	int ret;
> +
> +	node = create_port_node(port);
> +	if (IS_ERR(node))
> +		return PTR_ERR(node);
> +
> +	if (!connector_match(connector, node)) {
> +		remove_port_node(node);
> +		return 0;
> +	}
> +
> +	ret = link_port(to_typec_port(connector), node);
> +	if (ret) {
> +		remove_port_node(node->pld);
> +		return ret;
> +	}
> +
> +	get_device(connector);
> +
> +	return 0;
> +}
> +#endif
> +
> +int typec_link_ports(struct typec_port *con)
> +{
> +	int ret = 0;
> +
> +	con->pld = get_pld(&con->dev);
> +	if (!con->pld)
> +		return 0;
> +
> +#ifdef CONFIG_USB
> +	ret = usb_for_each_port(&con->dev, each_port);
> +	if (ret)
> +		typec_unlink_ports(con);

If you have proper #ifdef for CONFIG_USB in the .h file, then there's no
need for the #ifdef in the .c file.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ