From patchwork Tue May 24 12:31:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tang Bin X-Patchwork-Id: 12860153 X-Patchwork-Delegate: viresh.linux@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4398C433F5 for ; Tue, 24 May 2022 12:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231975AbiEXMeD (ORCPT ); Tue, 24 May 2022 08:34:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237350AbiEXMeC (ORCPT ); Tue, 24 May 2022 08:34:02 -0400 X-Greylist: delayed 184 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 24 May 2022 05:34:00 PDT Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com [221.176.66.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6AC1D95A27 for ; Tue, 24 May 2022 05:34:00 -0700 (PDT) X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from spf.mail.chinamobile.com (unknown[172.16.121.87]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee4628ccffe99c-f110b; Tue, 24 May 2022 20:30:54 +0800 (CST) X-RM-TRANSID: 2ee4628ccffe99c-f110b X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.108.79.97]) by rmsmtp-syy-appsvrnew04-12029 (RichMail) with SMTP id 2efd628ccffa4f6-ad1ba; Tue, 24 May 2022 20:30:53 +0800 (CST) X-RM-TRANSID: 2efd628ccffa4f6-ad1ba From: Tang Bin To: vireshk@kernel.org, nm@ti.com, sboyd@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Tang Bin Subject: [PATCH] opp: Fix error check in dev_pm_opp_attach_genpd() Date: Tue, 24 May 2022 20:31:51 +0800 Message-Id: <20220524123151.1416-1-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org dev_pm_domain_attach_by_name() may return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Fixes: 6319aee10e53 ("opp: Attach genpds to devices from within OPP core") Signed-off-by: Tang Bin --- drivers/opp/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 2945f3c1c..56cae6ee2 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2409,8 +2409,8 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, } virt_dev = dev_pm_domain_attach_by_name(dev, *name); - if (IS_ERR(virt_dev)) { - ret = PTR_ERR(virt_dev); + if (IS_ERR_OR_NULL(virt_dev)) { + ret = PTR_ERR(virt_dev) ? : -ENODATA; dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret); goto err; }