Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3603047pxb; Mon, 24 Jan 2022 13:17:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCa8FKq4MPLNClTi2EuOUgcWLDp0IeIGUlPs+s37KpW2ei+KNzvbGa+ZE2wKKs3Y0KH5Nn X-Received: by 2002:a17:90b:1c8c:: with SMTP id oo12mr222771pjb.148.1643059024894; Mon, 24 Jan 2022 13:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643059024; cv=none; d=google.com; s=arc-20160816; b=YxvSvwMnGJ1Mqy8I0yOf6q8F4UYB508YKJ9UTL4lywJKtLS+xVdyEvCADEuvu0TjLv kcCFkTnrH8k2b+jdjk/jspFyNnDteUAzVTYj6DJZWKyiZBbr1KKsgndOWkCWB1XkVzDl bNA1Mx4lQY1QKEjWfT/TqJbIFl6r61aS/CxbxKxE5Wul5FR+XGDMczkHJYBBXsNwSlFP tZ+RK4SEe2yd7D+7u6Q1F4rf7vbVRWeGGWdVd6Xae6Ia9uid1lF0qHuct0NZmS3EeF8N DuXSwsV9r99hnCBEPr1Dsy4SptQNiz+yOct9lpdTqWT3lrSf4CPaywVb40tdF9zGTB5Z yV/A== 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=JQ4H+UbjYRMLMmXc4NDmwQRVlXkcSOgIlL1NKi+BJnI=; b=eah0eN7M0Y4y6Ng8A04vi8LM/YwqBOYz+J3fMOfl5uU+FbRV+hB+rtvTqfW7FQOmQO QwwVSCKdVxbyJuVKrbW4cLzhZ2hUSoYVkkcgho8SXiql57moF9Gkq3Urc8c4qcDoLZcg eMXoyDafAePJQFou0XgADK6wcDxT0lQLsz0LtNDOzAtUAtkm0WzZ1u7SqcDmk2RG9xjL tl+4AdZ9Y7lCphuX3S2kulz4+z0uX3+4w23uMEiFkqw/jfq1NAOr/9bpqChdbRmUNYnt +96HFwTsVtG9QDcAYe+lYzDaSDT3BwstEVsmXhEDZVmylEK1YgzBFa/lJFeojeUyhvyP xDuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EyHQNQe8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h190si5991609pge.868.2022.01.24.13.16.52; Mon, 24 Jan 2022 13:17:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EyHQNQe8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1441892AbiAXUvu (ORCPT + 99 others); Mon, 24 Jan 2022 15:51:50 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35350 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384120AbiAXU2y (ORCPT ); Mon, 24 Jan 2022 15:28:54 -0500 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 1F5DDB81249; Mon, 24 Jan 2022 20:28:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49180C340E5; Mon, 24 Jan 2022 20:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056131; bh=E3RTaUgku1Rf9mVYCDXetqPO8OLq391heMQ/FMi8orE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EyHQNQe8QZX138DpTe3WVhcyROgvI7ZlmWzj+lFN5XzlIglQeUZ+CJA0HiQJhWKhK 5+hRAYnuS++9xV1+TB2A3gKtBRqvB4KgZc58F69ZIdOlOVthqMEKoFyITFQF6z8mug URg+RMpB5MDav9/RLSebAmbWCRPH2ghs7A5acDo8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lad Prabhakar , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.15 381/846] clk: renesas: rzg2l: Check return value of pm_genpd_init() Date: Mon, 24 Jan 2022 19:38:18 +0100 Message-Id: <20220124184114.085861691@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lad Prabhakar [ Upstream commit 27527a3d3b162e4512798c058c0e8a216c721187 ] Make sure we check the return value of pm_genpd_init() which might fail. Also add a devres action to remove the power-domain in-case the probe callback fails further down in the code flow. Fixes: ef3c613ccd68a ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC") Signed-off-by: Lad Prabhakar Link: https://lore.kernel.org/r/20211117115101.28281-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- drivers/clk/renesas/rzg2l-cpg.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c index 761922ea5db76..61e7c0c4f3794 100644 --- a/drivers/clk/renesas/rzg2l-cpg.c +++ b/drivers/clk/renesas/rzg2l-cpg.c @@ -638,10 +638,16 @@ static void rzg2l_cpg_detach_dev(struct generic_pm_domain *unused, struct device pm_clk_destroy(dev); } +static void rzg2l_cpg_genpd_remove(void *data) +{ + pm_genpd_remove(data); +} + static int __init rzg2l_cpg_add_clk_domain(struct device *dev) { struct device_node *np = dev->of_node; struct generic_pm_domain *genpd; + int ret; genpd = devm_kzalloc(dev, sizeof(*genpd), GFP_KERNEL); if (!genpd) @@ -652,7 +658,13 @@ static int __init rzg2l_cpg_add_clk_domain(struct device *dev) GENPD_FLAG_ACTIVE_WAKEUP; genpd->attach_dev = rzg2l_cpg_attach_dev; genpd->detach_dev = rzg2l_cpg_detach_dev; - pm_genpd_init(genpd, &pm_domain_always_on_gov, false); + ret = pm_genpd_init(genpd, &pm_domain_always_on_gov, false); + if (ret) + return ret; + + ret = devm_add_action_or_reset(dev, rzg2l_cpg_genpd_remove, genpd); + if (ret) + return ret; of_genpd_add_provider_simple(np, genpd); return 0; -- 2.34.1