power: supply: mt6370: Fix return value check in mt6370_chg_probe()

If create_singlethread_workqueue() fails, it returns a null pointer,
replace IS_ERR() check with NULL pointer check.

Fixes: 233cb8a47d ("power: supply: mt6370: Add MediaTek MT6370 charger driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: ChiaEn Wu <chiaen_wu@richtek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Yang Yingliang 2022-09-21 23:29:15 +08:00 коммит произвёл Sebastian Reichel
Родитель fe259a2155
Коммит 5738d49fa4
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -911,8 +911,8 @@ static int mt6370_chg_probe(struct platform_device *pdev)
priv->attach = MT6370_ATTACH_STAT_DETACH;
priv->wq = create_singlethread_workqueue(dev_name(priv->dev));
if (IS_ERR(priv->wq))
return dev_err_probe(dev, PTR_ERR(priv->wq),
if (!priv->wq)
return dev_err_probe(dev, -ENOMEM,
"Failed to create workqueue\n");
ret = devm_add_action_or_reset(dev, mt6370_chg_destroy_wq, priv->wq);