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]
Date: Fri, 24 May 2024 14:42:04 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Francesco Dolcini <francesco@...cini.it>
Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Francesco Dolcini <francesco.dolcini@...adex.com>, 
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Bjorn Andersson <andersson@...nel.org>
Subject: Re: [PATCH v1 2/2] usb: typec: mux: gpio-sbu: Make enable gpio
 optional

On Fri, May 24, 2024 at 01:31:58PM +0200, Francesco Dolcini wrote:
> Hello Dmitry,
> thanks for the review.
> 
> On Fri, May 24, 2024 at 12:56:15PM +0300, Dmitry Baryshkov wrote:
> > On Fri, May 24, 2024 at 09:10:34AM +0200, Francesco Dolcini wrote:
> > > From: Francesco Dolcini <francesco.dolcini@...adex.com>
> > > 
> > > The enable gpio is not required when the SBU mux is used only for
> > > orientation, make it optional.
> > > 
> > > Signed-off-by: Francesco Dolcini <francesco.dolcini@...adex.com>
> > > ---
> > >  drivers/usb/typec/mux/gpio-sbu-mux.c | 11 ++++++++---
> > >  1 file changed, 8 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
> > > index 374168482d36..cf44259980a1 100644
> > > --- a/drivers/usb/typec/mux/gpio-sbu-mux.c
> > > +++ b/drivers/usb/typec/mux/gpio-sbu-mux.c
> ...
> > > @@ -66,6 +66,9 @@ static int gpio_sbu_mux_set(struct typec_mux_dev *mux,
> > >  {
> > >  	struct gpio_sbu_mux *sbu_mux = typec_mux_get_drvdata(mux);
> > >  
> > > +	if (!sbu_mux->enable_gpio)
> > > +		return -EOPNOTSUPP;
> > 
> > Can we skip registering the mux if there is no enable_gpio? This can
> > save users from the unexpected errors during runtime.
> 
> Yes, I considered this option.
> 
> The rationale for the current implementation is that if the device tree is
> correct (no mode-switch property, when enable-gpios is not present), nobody
> will call gpio_sbu_mux_set() so no runtime error is possible. If the
> configuration in the DT is not correct you get this runtime error.
> 
> With your proposal in case the DT configuration is not correct there will be no
> errors from the kernel, but the functionality will not work.

I'm slightly biased maybe, but I prefer an error from probe (or
dependent devices being deferred). On the other hand, current motto is
that 'the kernel should not duplicate dt-validate's work'.

-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ