Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3135891rwb; Mon, 15 Aug 2022 19:02:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR79Y+mN3AJP2OAdpEvgMDfO8LvBRw2VcYH+nvFGGnyn5wYMofWXCqeeM+lNwXE2KTrbGz+H X-Received: by 2002:a17:902:d2d1:b0:16e:eeac:29ab with SMTP id n17-20020a170902d2d100b0016eeeac29abmr20134777plc.125.1660615377860; Mon, 15 Aug 2022 19:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660615377; cv=none; d=google.com; s=arc-20160816; b=Vk9BNY8/097D+OYPhCaJDCV3KPEWuQ210oFyA089GJ2l2Usm/AFu7Z2HEXfY6ZBfpt gLyGqXLHTPOxTFyzPHdBZYI7qPmC9TXS5uPJvWzEmD03nDn3k0hOhMF+8TzcLIdEVrs4 jN3aV+Gh6CKhY4FC8GgPjKT4hs8acjeH2w9AO3z56YV+HVBc86ymo81QBhfK6CfW6tGU fz2GQd9nYtpDoxL3T6azZy258ryFP6MJOQ+dQJ9p9RKHTjqATsUFCbObKvDwhONCoyvL vGgo5wXGs2myGKqLVKbJc7u9/lOK+ZogJnqVGC3pkpmiJtoXCUdMB1h/rymIUGwZgnTN JKcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j0XUYzdCwW5oZbzu6TBDO0M+dyAwDGkYuR29VGtVXus=; b=XE5kmlVX80aX9Gt55RLcLoj4QFDuUgSycdyFon2TmkddpWQi1gcgDbMj7SYH7MKv8y Qw7tEQW2rvMEVjvEUAiPOX+QplceoR8qJ9SbKUShvlBADkeCFb6e6kR5glVZPg9MMQHX HDOmZY7So6EkfNhIBENPGABpX2lZTj+7ei+zobXeytnmL5J5IGmUHkDFwmqQgHKTREpa 6fYFUoRvinsN0p04wzh6O+52XGjuu65PTisvZRo5CgYD0U3VR7l2wdPX/51/f28HcMb2 4VxVL+o0c6rbJdw8hndDJLNN0gyVZAeqEg/Ix+CJsd6jTet0upfCUXtvSz9/EoMidG1O Tr8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OEzmJviK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a17090340c800b0016ef1d39b5dsi11615196pld.224.2022.08.15.19.02.46; Mon, 15 Aug 2022 19:02:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OEzmJviK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345055AbiHPAhQ (ORCPT + 99 others); Mon, 15 Aug 2022 20:37:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346491AbiHPAeP (ORCPT ); Mon, 15 Aug 2022 20:34:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C12B8187FB2; Mon, 15 Aug 2022 13:37:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D959DB8113E; Mon, 15 Aug 2022 20:37:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13BE6C433D6; Mon, 15 Aug 2022 20:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595833; bh=rluxVmy3NVmSakIwv/OCznUngpWOb3PtWKVLTkuHedA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEzmJviKorsVs6xwzu9R8vzbgTFsq/yRlLNEyK5I17FSyA7IXWLFonDeM0vG02rQ1 IaDgjtj6P4XV9hBiefWA/8LvU+3GCqFMOsgj3CDr9xC/pf9SwXdaYkNLPp5Db69MG4 rrVLtw2WPQwNNCGnGsaHnLspd9II2Tz6GIRanBmA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Bin , Viresh Kumar , Sasha Levin Subject: [PATCH 5.19 0889/1157] opp: Fix error check in dev_pm_opp_attach_genpd() Date: Mon, 15 Aug 2022 20:04:05 +0200 Message-Id: <20220815180515.010892390@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tang Bin [ Upstream commit 4ea9496cbc959eb5c78f3e379199aca9ef4e386b ] 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 [ Viresh: Replace ENODATA with ENODEV ] Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- 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 84063eaebb91..ff0364733dcb 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2528,8 +2528,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) ? : -ENODEV; dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret); goto err; } -- 2.35.1