Re: [PATCH] ACPI / PMIC: Remove unneeded check in tps68470_pmic_opregion_probe()

From: Andy Shevchenko
Date: Tue Jul 30 2024 - 16:08:49 EST


On Fri, Jul 5, 2024 at 1:36 PM Aleksandr Mishin <amishin@xxxxxxxxxx> wrote:
>
> In tps68470_pmic_opregion_probe() pointer 'dev' is compared to NULL which
> is useless.
>
> Fix this issue by removing unneeded check.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.

...

> - if (!dev || !tps68470_regmap) {
> + if (!tps68470_regmap) {
> dev_warn(dev, "dev or regmap is NULL\n");

Now this message is misleading.

> return -EINVAL;
> }

And I dunno why it's a warning and not an error level.

With all above being said, I would recommend to update to

if (!tps68470_regmap)
return dev_err_probe(dev, -EINVAL, "regmap is missing\n");

--
With Best Regards,
Andy Shevchenko