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: <5cpa5e4mqq55gdkom3ug6ieocmbi2qaguwiaype6jijgzpuoij@ttukpn6mfsab>
Date: Fri, 25 Oct 2024 13:29:28 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Romain Gantois <romain.gantois@...tlin.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, 
	Conor Dooley <conor+dt@...nel.org>, Heikki Krogerus <heikki.krogerus@...ux.intel.com>, 
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>, linux-usb@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] usb: typec: mux: Add support for the TUSB1046
 crosspoint switch

On Fri, Oct 25, 2024 at 09:09:11AM +0200, Romain Gantois wrote:
> Hello Dmitry,
> 
> On vendredi 25 octobre 2024 08:39:54 UTC+2 Dmitry Baryshkov wrote:
> > On Thu, Oct 24, 2024 at 10:54:17AM +0200, Romain Gantois wrote:
> ...
> > > +
> > > +static int tusb1046_mux_set(struct typec_mux_dev *mux,
> > > +			    struct typec_mux_state *state)
> > > +{
> > > +	struct tusb1046_priv *priv = typec_mux_get_drvdata(mux);
> > > +	struct i2c_client *client = priv->client;
> > > +	struct device *dev = &client->dev;
> > > +	int mode, val, ret = 0;
> > > +
> > > +	if (state->mode >= TYPEC_STATE_MODAL &&
> > > +	    state->alt->svid != USB_TYPEC_DP_SID)
> > > +		return -EINVAL;
> > > +
> > > +	dev_dbg(dev, "mux mode requested: %lu\n", state->mode);
> > > +
> > > +	mutex_lock(&priv->general_reg_lock);
> > > +
> > > +	val = i2c_smbus_read_byte_data(client, TUSB1046_REG_GENERAL);
> > > +	if (val < 0) {
> > > +		dev_err(dev, "failed to read ctlsel status, err %d\n", val);
> > > +		ret = val;
> > > +		goto out_unlock;
> > > +	}
> > > +
> > > +	switch (state->mode) {
> > > +	case TYPEC_STATE_USB:
> > > +		mode = TUSB1046_CTLSEL_USB3;
> > > +		break;
> > 
> > > +	case TYPEC_DP_STATE_C:
> > These are only valid if you have checked that altmode SVID is a
> > DisplayPort SVID.
> 
> I did check it near the beginning of the function didn't I?
> 
> > > +	if (state->mode >= TYPEC_STATE_MODAL &&
> > > +	    state->alt->svid != USB_TYPEC_DP_SID)
> > > +		return -EINVAL;
> 
> Or is there something I'm missing?

Indeed, excuse me. I missed it.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>


> 
> Thanks for the review,
> 
> -- 
> Romain Gantois, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> 
> 
> 

-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ