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:   Fri, 27 Mar 2020 09:38:21 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Wolfram Sang <wsa+renesas@...g-engineering.com>
Cc:     linux-i2c <linux-i2c@...r.kernel.org>,
        Andy Shevchenko <andy@...radead.org>,
        Darren Hart <dvhart@...radead.org>,
        Vadim Pasternak <vadimp@...lanox.com>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()

On Thu, Mar 26, 2020 at 11:10 PM Wolfram Sang
<wsa+renesas@...g-engineering.com> wrote:
>
> Move away from the deprecated API and return the shiny new ERRPTR where
> useful.
>

Acked-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Signed-off-by: Wolfram Sang <wsa+renesas@...g-engineering.com>
> ---
>  drivers/platform/mellanox/mlxreg-hotplug.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c
> index 77be37a1fbcf..ed48917af162 100644
> --- a/drivers/platform/mellanox/mlxreg-hotplug.c
> +++ b/drivers/platform/mellanox/mlxreg-hotplug.c
> @@ -101,6 +101,7 @@ static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
>                                         struct mlxreg_core_data *data)
>  {
>         struct mlxreg_core_hotplug_platform_data *pdata;
> +       struct i2c_client *client;
>
>         /* Notify user by sending hwmon uevent. */
>         kobject_uevent(&priv->hwmon->kobj, KOBJ_CHANGE);
> @@ -121,18 +122,20 @@ static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
>                 return -EFAULT;
>         }
>
> -       data->hpdev.client = i2c_new_device(data->hpdev.adapter,
> -                                           data->hpdev.brdinfo);
> -       if (!data->hpdev.client) {
> +       client = i2c_new_client_device(data->hpdev.adapter,
> +                                      data->hpdev.brdinfo);
> +       if (IS_ERR(client)) {
>                 dev_err(priv->dev, "Failed to create client %s at bus %d at addr 0x%02x\n",
>                         data->hpdev.brdinfo->type, data->hpdev.nr +
>                         pdata->shift_nr, data->hpdev.brdinfo->addr);
>
>                 i2c_put_adapter(data->hpdev.adapter);
>                 data->hpdev.adapter = NULL;
> -               return -EFAULT;
> +               return PTR_ERR(client);
>         }
>
> +       data->hpdev.client = client;
> +
>         return 0;
>  }
>
> --
> 2.20.1
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ