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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1945710.vURJNgTSzn@fw-rgant>
Date: Fri, 25 Oct 2024 09:09:11 +0200
From: Romain Gantois <romain.gantois@...tlin.com>
To: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
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

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?

Thanks for the review,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ