public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-pm@vger.kernel.org>, <linux-mediatek@lists.infradead.org>
Cc: <sre@kernel.org>, <chiaen_wu@richtek.com>
Subject: [PATCH -next] power: supply: mt6370: Fix return value check in mt6370_chg_probe()
Date: Wed, 21 Sep 2022 23:29:15 +0800	[thread overview]
Message-ID: <20220921152915.1506767-1-yangyingliang@huawei.com> (raw)

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

Fixes: 233cb8a47d65 ("power: supply: mt6370: Add MediaTek MT6370 charger driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/power/supply/mt6370-charger.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/mt6370-charger.c b/drivers/power/supply/mt6370-charger.c
index 716cba259a7a..f27dae5043f5 100644
--- a/drivers/power/supply/mt6370-charger.c
+++ b/drivers/power/supply/mt6370-charger.c
@@ -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);
-- 
2.25.1


             reply	other threads:[~2022-09-21 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 15:29 Yang Yingliang [this message]
2022-09-22  1:42 ` [PATCH -next] power: supply: mt6370: Fix return value check in mt6370_chg_probe() ChiaEn Wu
2022-09-22  7:25 ` AngeloGioacchino Del Regno
2022-10-01 20:22 ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220921152915.1506767-1-yangyingliang@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=chiaen_wu@richtek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox