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]
Date:   Mon, 3 Feb 2020 21:11:56 +0000
From:   Chris Packham <Chris.Packham@...iedtelesis.co.nz>
To:     "andy.shevchenko@...il.com" <andy.shevchenko@...il.com>
CC:     "linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [PATCH v4 2/2] spi: Add generic SPI multiplexer

Hi Andy,

On Mon, 2020-02-03 at 11:50 +0200, Andy Shevchenko wrote:

Other comments all accepted and will be addressed in v5.

> 
> ...
> 
> 
> > +       priv->mux = devm_mux_control_get(&spi->dev, NULL);
> > +       ret = PTR_ERR_OR_ZERO(priv->mux);
> 
> This is a bit complicated.
> 
> > +       if (ret) {
> 
> Why not simple do
> 
>   if (IS_ERR(priv->mux)) {
>     ret = PTR_ERR(...);
>     ...
>   }
> 
> ?

I've had other maintainers/reviewers suggest the opposite for patches
I've submitted to other subsystems which is why I went with
PTR_ERR_OR_ZERO. It also works well with the goto err_put_ctlr; which
needs ret to be set. It's not exactly a common pattern in the spi code
so I'd be happy to go the other way if that's the desired convention
for spi.

> 
> > +               if (ret != -EPROBE_DEFER)
> > +                       dev_err(&spi->dev, "failed to get control-mux\n");
> > +               goto err_put_ctlr;
> > +       }
> > +       ctlr->dev.of_node = spi->dev.of_node;
> 
> I'm wondering why SPI core can't handle this by default (like GPIO
> subsystem does).
> 

We do have it for spi devices in of_register_spi_device(). I'm not
aware of any reason spi_register_controller() couldn't do the same for
controllers. It would affect a large number of drivers so should
probably be separate to this series. It's probably reasonably
automatable with coccinelle.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ