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: <ZAXWbkq4oLfrWUR7@smile.fi.intel.com>
Date:   Mon, 6 Mar 2023 14:02:54 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Pin-yen Lin <treapking@...omium.org>
Cc:     Andrzej Hajda <andrzej.hajda@...el.com>,
        Neil Armstrong <neil.armstrong@...aro.org>,
        Robert Foss <rfoss@...nel.org>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Jonas Karlman <jonas@...boo.se>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Daniel Scally <djrscally@...il.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Prashant Malani <pmalani@...omium.org>,
        Benson Leung <bleung@...omium.org>,
        Guenter Roeck <groeck@...omium.org>,
        Xin Ji <xji@...logixsemi.com>,
        Javier Martinez Canillas <javierm@...hat.com>,
        Lyude Paul <lyude@...hat.com>, linux-kernel@...r.kernel.org,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        chrome-platform@...ts.linux.dev,
        NĂ­colas F . R . A . Prado 
        <nfraprado@...labora.com>, Marek Vasut <marex@...x.de>,
        Hsin-Yi Wang <hsinyi@...omium.org>, devicetree@...r.kernel.org,
        Allen Chen <allen.chen@....com.tw>,
        dri-devel@...ts.freedesktop.org,
        Thomas Zimmermann <tzimmermann@...e.de>,
        Stephen Boyd <swboyd@...omium.org>, linux-acpi@...r.kernel.org
Subject: Re: [PATCH v13 10/10] drm/bridge: it6505: Register Type C mode
 switches

On Fri, Mar 03, 2023 at 10:33:50PM +0800, Pin-yen Lin wrote:
> Register USB Type-C mode switches when the "mode-switch" property and
> relevant port are available in Device Tree. Configure the "lane_swap"
> state based on the entered alternate mode for a specific Type-C
> connector, which ends up updating the lane swap registers of the it6505
> chip.

...

> +	it6505->port_data = devm_kcalloc(dev, switch_desc->num_typec_switches,
> +					 sizeof(struct it6505_typec_port_data),
> +					 GFP_KERNEL);

> +

Same, no need for a blank line here.

> +	if (!it6505->port_data) {
> +		ret = -ENOMEM;
> +		goto unregister_mux;
> +	}

...

> +		it6505->port_data[i].lane_swap = (dp_lanes[0] / 2 == 1);

' % 2 == 0' ?

...

Wouldn't be better to have

	ret = PTR_ERR_OR_ZERO(extcon);

here and amend the following accordingly?

>  	if (PTR_ERR(extcon) == -EPROBE_DEFER)
>  		return -EPROBE_DEFER;
>  	if (IS_ERR(extcon)) {
> -		dev_err(dev, "can not get extcon device!");
> -		return PTR_ERR(extcon);
> +		if (PTR_ERR(extcon) != -ENODEV)
> +			dev_warn(dev, "Cannot get extcon device: %ld\n",
> +				 PTR_ERR(extcon));
> +		it6505->extcon = NULL;
> +	} else {
> +		it6505->extcon = extcon;
>  	}
>  
> -	it6505->extcon = extcon;
> +	init_completion(&it6505->mux_register);
> +	ret = it6505_register_typec_switches(dev, it6505);
> +	if (ret) {
> +		if (ret != -ENODEV)
> +			dev_warn(dev, "Didn't register Type-C switches, err: %d\n",
> +				 ret);
> +		if (!it6505->extcon) {
> +			dev_err(dev, "Both extcon and typec-switch are not registered.\n");
> +			return -EINVAL;
> +		}
> +	}


Perhaps

	if (ret != -ENODEV)
		dev_warn(dev, "Didn't register Type-C switches, err: %d\n", ret);

	if (ret && !it6505->extcon) {
		dev_err(dev, "Both extcon and typec-switch are not registered.\n");
		return ret;
	}

?

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ