Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3022209rwb; Mon, 15 Aug 2022 16:19:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7rsolZkiCQto5kYMx7f1j3BYaocFSeqkxGcPcZUGsurOiD97kwc78887mAX4ZNnqPDkUzA X-Received: by 2002:a17:907:75f0:b0:730:870b:76a6 with SMTP id jz16-20020a17090775f000b00730870b76a6mr11038416ejc.570.1660605581767; Mon, 15 Aug 2022 16:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605581; cv=none; d=google.com; s=arc-20160816; b=D3IrwqKzffeRj379RoVK940H4K8jj76OGIzqlbWaFF/wECQtXx7v+//b7/VZ3UK/3O SDW3oWxtrWoGWEDB7GOlrSW64UEfsgRSRiHXyMqiqp1MWd5VoYOc/zyvaoERGxzpkTbF 5Yrq9tVaKhwBq7k6nL72rAtAjQghyZ4SOUCoLYv366s/OYKhHXNAOyR7h/pO8/lQPY3h PsqAKpuUpLwk05Y0JCkzbJNPgkeEALU0EOJ0Q0/fUlm3uI+VNlQTX1HsN5ljfZNkRVM0 CJ2XqWrDpLJg7B9G8vUe0zIxPGn0DRdWaxG00pRT325OSPFeaqzfv9VOf3/WD0VnAgrD suhQ== 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=a+6Z2vkFA//+z6w+Nk5k08wBWH865Hf2sqiMDdzjRpo=; b=OJ9Hm6ZZbzIDOdhk3wzJFYg+X7Q3W+ZYHjjOP9PGr3BISPhDobGGCGLy5O4r7MSquS CrWiqU0y8UNZIH8Hgvr08eXz5jTYxjfu2PhKQlCT/BakjB9Ht5N+7XqAAnDPIMbNvOWC S2zmbTxEjrkFssM4mjCYx4nAbz2oDMigpkOruoiorYWCnzA1a4zvH5116AOm60AsBQM6 0U3nHbB1WcU4xGPQut+jCoujvcnL/TW2XngYOH+11N5GiehO06jvqCTjpLW44qP6+Xpt GJ5cD4W/uZYbY22b5mQS/nwLSLm6AzRcuEVJwgZURq2UQEqV/yKi1/9dNwndJ8AsggEr vT1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qk9xudA/"; 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 v8-20020a170906338800b007306d40ae27si7596647eja.553.2022.08.15.16.19.16; Mon, 15 Aug 2022 16:19:41 -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="Qk9xudA/"; 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 S1349841AbiHOWbK (ORCPT + 99 others); Mon, 15 Aug 2022 18:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349755AbiHOW0I (ORCPT ); Mon, 15 Aug 2022 18:26:08 -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 2CC1D127BDF; Mon, 15 Aug 2022 12:44:52 -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 B8B43B81145; Mon, 15 Aug 2022 19:44:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA3AEC433D6; Mon, 15 Aug 2022 19:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592689; bh=CQV3gtFCOEyCWtZCTkXMTvy003w/H2jNvTviBBARrVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qk9xudA/hx57GE0mKnPUuCo3wje5LXqCQgLtmX1BmRNMq7DdAJcH9iHM0jCtzfsDe rSgP4HE0X9VypquIgqj+cVuZ5RfYakZSkfqO+x1SEKjX7zok1XCdJ+VBykjbB4wmGw TG/qzLBuCHtwnW2GjFbFkazMNztR08EKabG8t8W4= 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.18 0826/1095] opp: Fix error check in dev_pm_opp_attach_genpd() Date: Mon, 15 Aug 2022 20:03:45 +0200 Message-Id: <20220815180503.476260372@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 740407252298..e154b18ec4b1 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2413,8 +2413,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