Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2927754rwb; Mon, 15 Aug 2022 14:13:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR5HR9UWqvhnrl4hbYH88V1LSRQprBbIM0WFzzBVbU4AEXxQzeHQxOXQwInjTc2nIhR8eTqK X-Received: by 2002:a17:902:d546:b0:16e:c70c:fdf5 with SMTP id z6-20020a170902d54600b0016ec70cfdf5mr19114226plf.100.1660597994072; Mon, 15 Aug 2022 14:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597994; cv=none; d=google.com; s=arc-20160816; b=XgxxP5AFsEpausoa9O6SL8+tsxeFyoU/RDD0KRxTr6l6f+IOP576dv9H2OrjFHxat+ W0jafuPh0pqt1yDS9OlaDgLCExvbkf+Kor6B+o254KstEc7GrasX6CjelJmcOk/rO3uf yYw2Vlr4MbWGxiEmHYGxWoXnhgJ3QjlYaFjVsh9ynhGI7C+B7o0PEsCUE9anXe4iXdjY MJkQs2yB35KEMClsLaNKzvGfl5zu8LIs3Zn9NZqyTawXWKf3RCng+wy282ZA6JK2OqJS 1mWdRRyf8Vb1KmB1GHKna/impl+wPs16Kh0AuPDtH0dwszaL0fKOhJKd/6LvSSPovjBd czhg== 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=bUGZ7QgieeVjY4z2PDfF12dZJp7Rpcqsd4pw3NiA7T4=; b=mWEeyYtS02XVFEu0t9x9+wny1zhSGt6XGawWcVgnPMOjS6uKbnq89YEoNvojX2Gu/H aiBtSCOlmch9ou/BDq/YJF/k/YMG2LICK4ifEoyyTkxDoMgnP/JfOQWsT8q1yhkQtxR8 V3G90fgeox6XQw3sPPu2duusoywvMVf0/IClH2Xd1qoC64pZ7XW0URSv8AZnjttseCjQ CXiYmEX2U7LWjjmbVWAW5ea2RgqE0NQsJf2vJ486AY8E1CEyQk2hzASxaR0Pqt6zXIGZ V9z0/3JO3S56ZgmBKId0ndl8rfhm6zV+SAuTjHWACdjVUqEMaUdP0nE/RkRncaPpAOg1 L6MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XsS5sARa; 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 k17-20020a056a00169100b005284d10c1d3si11901542pfc.333.2022.08.15.14.13.02; Mon, 15 Aug 2022 14:13:14 -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=XsS5sARa; 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 S1343610AbiHOTf3 (ORCPT + 99 others); Mon, 15 Aug 2022 15:35:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345107AbiHOT1s (ORCPT ); Mon, 15 Aug 2022 15:27:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE215C96D; Mon, 15 Aug 2022 11:43:38 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 83B3661120; Mon, 15 Aug 2022 18:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76D75C433C1; Mon, 15 Aug 2022 18:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589017; bh=c6POu7CxEZAtsyfak6/OCQvCWxH0FLYJlmluklao9ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XsS5sARaZncgAuT4TBFj5/7LjkMoUXFutZly3zWHrlXFvx0NMOvsPCRCdTmKoCLyq 5L3Jf7s1czWizHICL9vkGQvp9vRLgiA9epmju6AqLhIMuGOeE6jaiGoRifUpxbkIvA 19nl1jtcNlUt/x3Ft+el41ARBeDTyo3IyEX2MBvQ= 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.15 560/779] opp: Fix error check in dev_pm_opp_attach_genpd() Date: Mon, 15 Aug 2022 20:03:24 +0200 Message-Id: <20220815180401.279999844@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 04b4691a8aac..b2da497dd378 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2388,8 +2388,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