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: <CAFRkauBcXDVihxN8MHoStGHjDyx-VyOe6tT8dkY2tAisHoeE8w@mail.gmail.com>
Date:   Sat, 26 Jun 2021 11:41:50 +0800
From:   Axel Lin <axel.lin@...ics.com>
To:     Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linuxarm@...wei.com, mauro.chehab@...wei.com,
        Lee Jones <lee.jones@...aro.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-staging@...ts.linux.dev
Subject: Re: [PATCH v9 2/5] regulator: hi6421v600-regulator: fix platform drvdata

> @@ -231,7 +228,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
>  {
>         struct device *pmic_dev = pdev->dev.parent;
>         struct regulator_config config = { };
> -       struct hi6421_spmi_reg_priv *priv;
> +       struct hi6421_spmi_reg_info *sreg;
>         struct hi6421_spmi_reg_info *info;
>         struct device *dev = &pdev->dev;
>         struct hi6421_spmi_pmic *pmic;
> @@ -247,18 +244,17 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
>         if (WARN_ON(!pmic))
>                 return -ENODEV;
>
> -       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> -       if (!priv)
> +       sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL);
> +       if (!sreg)
>                 return -ENOMEM;
>
> -       mutex_init(&priv->enable_mutex);
> -       platform_set_drvdata(pdev, priv);
> +       sreg->enable_mutex = &pmic->enable_mutex;
>
>         for (i = 0; i < ARRAY_SIZE(regulator_info); i++) {
>                 info = &regulator_info[i];
>
>                 config.dev = pdev->dev.parent;
> -               config.driver_data = info;
> +               config.driver_data = sreg;

This won't work and that was what my patch fixed.
e.g. When you call
struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev);
sreg->eco_mode_mask and sreg->eco_uA will always be 0.

Regards,
Axel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ