Re: [PATCH v3 3/3] hwmon: tmp513: Simplify tmp51x_read_properties()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Biju,

On Fri, Aug 25, 2023 at 10:54 PM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> Simplify tmp51x_read_properties() by replacing 'nfactor' ->'data->nfactor'
> in device_property_read_u32_array() and drop the local variable as it is
> unused.
>
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/hwmon/tmp513.c
> +++ b/drivers/hwmon/tmp513.c
> @@ -680,10 +679,8 @@ static int tmp51x_read_properties(struct device *dev, struct tmp51x_data *data)
>         if (ret < 0)
>                 return ret;
>
> -       ret = device_property_read_u32_array(dev, "ti,nfactor", nfactor,
> -                                           data->max_channels - 1);
> -       if (ret >= 0)
> -               memcpy(data->nfactor, nfactor, data->max_channels - 1);
> +       device_property_read_u32_array(dev, "ti,nfactor", data->nfactor,
> +                                      data->max_channels - 1);

My first thought was that this could cause a small change in behavior.
However, the comments for of_property_read_u32_array() and
of_property_read_variable_u32_array() state:

 * The out_values is modified only if a valid u32 value can be decoded.

and the implementation behaves that way.

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux