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: <zgyd3zghhwivsr3b4pcipt2wfc26ypavjygd6lu5tg3k6ztwbr@t52w4p5kyvaa>
Date: Thu, 14 Nov 2024 08:23:54 +0100
From: Sean Nyekjaer <sean@...nix.com>
To: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: Marc Kleine-Budde <mkl@...gutronix.de>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Rob Herring <robh@...nel.org>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, linux-can@...r.kernel.org, 
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v2 1/2] can: tcan4x5x: add option for selecting nWKRQ
 voltage

Hi Vincent,

On Thu, Nov 14, 2024 at 01:53:34PM +0100, Vincent Mailhol wrote:
> On Mon. 11 Nov. 2024 at 17:55, Sean Nyekjaer <sean@...nix.com> wrote:
> > nWKRQ supports an output voltage of either the internal reference voltage
> > (3.6V) or the reference voltage of the digital interface 0 - 6V.
> > Add the devicetree option ti,nwkrq-voltage-sel to be able to select
> > between them.
> > Default is kept as the internal reference voltage.
> >
> > Signed-off-by: Sean Nyekjaer <sean@...nix.com>
> > ---
> >  drivers/net/can/m_can/tcan4x5x-core.c | 35 +++++++++++++++++++++++++++++++++++
> >  drivers/net/can/m_can/tcan4x5x.h      |  2 ++
> >  2 files changed, 37 insertions(+)
> >

[...]

> >
> > +static int tcan4x5x_get_dt_data(struct m_can_classdev *cdev)
> > +{
> > +       struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev);
> > +       struct device_node *np = cdev->dev->of_node;
> > +       u8 prop;
> > +       int ret;
> > +
> > +       ret = of_property_read_u8(np, "ti,nwkrq-voltage-sel", &prop);
> > +       if (!ret) {
> > +               if (prop <= 1)
> > +                       tcan4x5x->nwkrq_voltage = prop;
> > +               else
> > +                       dev_warn(cdev->dev,
> > +                                "nwkrq-voltage-sel have invalid option: %u\n",
> > +                                prop);
> > +       } else {
> > +               tcan4x5x->nwkrq_voltage = 0;
> > +       }
> 
> If the
> 
>   if (prop <= 1)
> 
> condition fails, you print a warning, but you are not assigning a
> value to tcan4x5x->nwkrq_voltage. Is this intentional?
> 
> What about:
> 
>         tcan4x5x->nwkrq_voltage = 0;
>         ret = of_property_read_u8(np, "ti,nwkrq-voltage-sel", &prop);
>         if (!ret) {
>                 if (prop <= 1)
>                         tcan4x5x->nwkrq_voltage = prop;
>                 else
>                         dev_warn(cdev->dev,
>                                  "nwkrq-voltage-sel have invalid option: %u\n",
>                                  prop);
>         }
> 
> so that you make sure that tcan4x5x->nwkrq_voltage always gets a
> default zero value? Else, if you can make sure that tcan4x5x is always
> zero initialized, you can just drop the
> 
>         tcan4x5x->nwkrq_voltage = 0;
> 
> thing.

Thanks for the review.
You are right, so I reworked this for v3:
https://lore.kernel.org/r/20241112-tcan-wkrqv-v3-0-c66423fba26d@geanix.com

> 
> > +       return 0;
> > +}
> > +

[...]

> >
> >

/Sean

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ