Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1865046rwb; Fri, 19 Aug 2022 10:40:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR661D7F7sxB2xjLjbcz71UVEAWt74L9kr3btE42LYANPmWNRYVXmay2hqHTN93N3uCeoh38 X-Received: by 2002:a17:90b:3e86:b0:1f5:2b4f:7460 with SMTP id rj6-20020a17090b3e8600b001f52b4f7460mr15284883pjb.97.1660930805963; Fri, 19 Aug 2022 10:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930805; cv=none; d=google.com; s=arc-20160816; b=dojICP9M901pnIBRmAJrMZQpUJ+Yi20hiSL+WY8oyWRukWACwUHrf2eqCa1BetFrOk SiSKamXKIR3cqej4eOVmDVuJmVKfU+2/69mlgwFWV5Rvh3wikPBeURHyCcFQA3yW0ZFN pFohNdoxFgfDFPEcTLVlXLcWP/xRL5F5fbl6rJABWmCTCn3vw4faMJOiqdYKbD5kJgd1 FO//IB37XEw+ZjYG+yEnQ8HNSrBQAw+p9BFNdctb+sm9RzCgG14Q3/xI0L4//HFHkAWY eSTVc5fSEq8tOjC/1jI6MSESemIg8zj/awjpQf9X9lHtq/NbzT/tpQas1DbEmWnJuJ01 2z8g== 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=Ghfl23NDIOi6GiuvaPcJCxs29J+PUOgv1DeqW/Cgtzo=; b=v4NCyowH44Cdps2lqmzHxuqpi2/v1gJNhcYMliR5c4n/IiUmnO9JaNlREBNE1ZakhF fh223b3Q9HkZrPLHdyQOXkBwQEYgcVNDivGedP/tUNkxZzm2RnPGdyc6etqPgfW0T2aS qpBp1QbEJglyjCsM2UUDpBY+thUzCVamTxuLEdSg3tN0vfyP+j0vbdaH+pbZMjUDQiWd BQse0hCSeWEr7V9R9NH0OA9f9+m3vMeMe+goJo56QczGzffRJHEJPV7Gsbnn80g42k17 PjRihfc/2yy+PhPCVoo/vuwu5Qmt2VddPcMYBCSJ82qnQEI2L70wCRXY2+jtkeNLk8Cv de8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pxV3vPGa; 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 ix9-20020a170902f80900b0016f975be2f2si4204365plb.545.2022.08.19.10.39.55; Fri, 19 Aug 2022 10:40:05 -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=pxV3vPGa; 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 S1352557AbiHSQ3O (ORCPT + 99 others); Fri, 19 Aug 2022 12:29:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353078AbiHSQ0K (ORCPT ); Fri, 19 Aug 2022 12:26:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33E99118DDC; Fri, 19 Aug 2022 09:03:59 -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 E073C612DF; Fri, 19 Aug 2022 16:03:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E00C3C433C1; Fri, 19 Aug 2022 16:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925038; bh=4kBoXY0BZDoFI4KFDOmjwABTYguL/gf9UutjHbV1I2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxV3vPGaQflxaon19vdEdAGOwFE8mKaeS0SK9F8ZjYTg/N+3Vmnno+3zHgNPSjxgh 1iJd/vOB+hkaQhFP6vNyWsRIh2I7+8PfTPXfRwlP3BvLqbuEgblN8T7xhTpqHpSbZD VAnZK5+mugAQkk5VrT1eFMoZTkt5Jgk68ZOGzHCk= 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.10 363/545] opp: Fix error check in dev_pm_opp_attach_genpd() Date: Fri, 19 Aug 2022 17:42:13 +0200 Message-Id: <20220819153845.621941830@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 903b465c8568..7ed605ffb717 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2052,8 +2052,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