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: <CAC=S1niBX4cL7EaROvG9NKSrnFFqCj+EPAZx0KASNTcF9F6E0Q@mail.gmail.com>
Date:   Wed, 9 Jun 2021 18:02:11 +0800
From:   Fei Shao <fshao@...omium.org>
To:     Gene Chen <gene.chen.richtek@...il.com>
Cc:     lee.jones@...aro.org, Matthias Brugger <matthias.bgg@...il.com>,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
        gene_chen@...htek.com, Wilma.Wu@...iatek.com,
        shufan_lee@...htek.com, cy_huang@...htek.com
Subject: Re: [PATCH v8 08/10] mfd: mt6360: Fix flow which is used to check ic exist

On Tue, May 18, 2021 at 1:36 AM Gene Chen <gene.chen.richtek@...il.com> wrote:
>
> From: Gene Chen <gene_chen@...htek.com>
>
> Fix flow which is used to check ic exist.
>
> Signed-off-by: Gene Chen <gene_chen@...htek.com>
> Acked-for-MFD-by: Lee Jones <lee.jones@...aro.org>
> ---
>  drivers/mfd/mt6360-core.c | 32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
> index 50a170065a98..cdd99770f94a 100644
> --- a/drivers/mfd/mt6360-core.c
> +++ b/drivers/mfd/mt6360-core.c
> @@ -293,6 +293,25 @@ static const struct mfd_cell mt6360_devs[] = {
>                     NULL, 0, 0, "mediatek,mt6360-tcpc"),
>  };
>
> +static int mt6360_check_vendor_info(struct mt6360_ddata *ddata)
> +{
> +       u32 info;
> +       int ret;
> +
> +       ret = regmap_read(ddata->regmap, MT6360_PMU_DEV_INFO, &info);
> +       if (ret < 0)

A dev_err() to indicate the read info error? (it used to be there)

> +               return ret;
> +
> +       if ((info & CHIP_VEN_MASK) != CHIP_VEN_MT6360) {
> +               dev_err(ddata->dev, "Device not supported\n");
> +               return -ENODEV;
> +       }
> +
> +       ddata->chip_rev = info & CHIP_REV_MASK;
> +
> +       return 0;
> +}
> +
>  static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = {
>         MT6360_PMU_SLAVEID,
>         MT6360_PMIC_SLAVEID,
> @@ -303,7 +322,6 @@ static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = {
>  static int mt6360_probe(struct i2c_client *client)
>  {
>         struct mt6360_ddata *ddata;
> -       unsigned int reg_data;
>         int i, ret;
>
>         ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL);
> @@ -319,17 +337,9 @@ static int mt6360_probe(struct i2c_client *client)
>                 return PTR_ERR(ddata->regmap);
>         }
>
> -       ret = regmap_read(ddata->regmap, MT6360_PMU_DEV_INFO, &reg_data);
> -       if (ret) {
> -               dev_err(&client->dev, "Device not found\n");
> +       ret = mt6360_check_vendor_info(ddata);
> +       if (ret)
>                 return ret;
> -       }
> -
> -       ddata->chip_rev = reg_data & CHIP_REV_MASK;
> -       if (ddata->chip_rev != CHIP_VEN_MT6360) {
> -               dev_err(&client->dev, "Device not supported\n");
> -               return -ENODEV;
> -       }
>
>         ret = devm_regmap_add_irq_chip(&client->dev, ddata->regmap, client->irq,
>                                        0, 0, &mt6360_irq_chip,
> --
> 2.25.1
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ