Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1629037pxb; Wed, 9 Feb 2022 00:33:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJx54Kno5EaUR9T2dauIncIHEkY1Ss6Md8L91jopT6EfJ7qOARUvIXKdia17R6vy8Jt16vEx X-Received: by 2002:a17:907:2d94:: with SMTP id gt20mr962514ejc.501.1644395590928; Wed, 09 Feb 2022 00:33:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644395590; cv=none; d=google.com; s=arc-20160816; b=RSOnX8Q2ptCxozq5WN6bxtvFZdxEpRao3ZgiKz1TMFmAvDvHNSvDa3LRRx35BfTl2Y fj8agpBgB+xRIk18i3V1cyRSmfNbb5HOAKj2Tsb6p1LXtOfRqtxZDbfGVNdZi9bvmf8G 810WhLM30Wv1pXXIBDSwdxXRjmyodLtD4Ap/8oPL25yBgLT+yW2tlO7TlrfxZ3Dn5CVx yycCdwtMLw6L5VVEA6YKPRgJlt4kQw+G+ZJnCvQMFOPA9K2esOj8OEXAsGi9UqbGJegR /PtHcQm3TNEnuNKy5odySGOKEReC4zBpfHCciNoxV/RVZ7r5sWlOB8xcWbmb6G2gY2VF N4Vw== 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=79XJXvfy5HQqFR1p9w1lMXnR7CHg1mb3vmCLjg+PHfo=; b=aTmGBVD7jFWGZf7tWS5i6qehKcDyrEqCc3inUQHKwoSaaJoDlPkKXFCBcVEYiNwZWf zrmgYoAFWItLyXk6FMgbc5OxX7xg5FChFpBpgH9FdiLu1lvkY+yoPfSZbqrdQ5TMsHSz WRkEKL309V4paT2ImQQnguoqZQDk3vXMww+18vY2o6+4mMRvDLHaiZgO7FKFmf6RCIDL GIRBL7++58guGDNyKCTHCT58xWlbcIycYDZfG0oj+c+rG2ZUCOGUtabOMLgnBJybfSyC ftvu3W2rEC8Pvpi7dlcUUXsw1w58/t0em+/n6U9eRNqqhq3fA8VlFHCxh15VHxn75LO9 TL/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oBJ5uEnQ; 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 1si9941236ejq.174.2022.02.09.00.32.45; Wed, 09 Feb 2022 00:33:10 -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=oBJ5uEnQ; 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 S1391194AbiBGL6n (ORCPT + 99 others); Mon, 7 Feb 2022 06:58:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384322AbiBGL1z (ORCPT ); Mon, 7 Feb 2022 06:27:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E8A9C03FEC9; Mon, 7 Feb 2022 03:26:04 -0800 (PST) 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 12D5A614D7; Mon, 7 Feb 2022 11:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAABBC004E1; Mon, 7 Feb 2022 11:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233163; bh=XRGvNkqVwgskbwyTHU3F4u6+gEJdsITDycdsfzLfWyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oBJ5uEnQan3a/PNmUEQIxYlEA4nYkLBebxLzvHMwNpjp/cOWcWNwuHbwsZNfHGU5n 5bM/bgNY5kZlGixUbNGIIIg8JiYpJY/UQT3YcQdYMdnuuRYJLMf3LMNLs7QWf0P9ou VZm/k0zfJ4P04PIWDYSTtukiKjKWfLBPmaDBbuJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , James Liao , Kevin Hilman , Frank Wunderlich , Daniel Golle , Guenter Roeck Subject: [PATCH 5.15 036/110] Revert "ASoC: mediatek: Check for error clk pointer" Date: Mon, 7 Feb 2022 12:06:09 +0100 Message-Id: <20220207103803.489983104@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103802.280120990@linuxfoundation.org> References: <20220207103802.280120990@linuxfoundation.org> User-Agent: quilt/0.66 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: Guenter Roeck This reverts commit 38accfd85e41b7ca547c5a7d4866bbc1462950cb which is commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e upstream With this patch in the tree, Chromebooks running the affected hardware no longer boot. Bisect points to this patch, and reverting it fixes the problem. An analysis of the code with this patch applied shows: ret = init_clks(pdev, clk); if (ret) return ERR_PTR(ret); ... for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) { struct clk *c = clk[data->clk_id[j]]; if (IS_ERR(c)) { dev_err(&pdev->dev, "%s: clk unavailable\n", data->name); return ERR_CAST(c); } scpd->clk[j] = c; } Not all clocks in the clk_names array have to be present. Only the clocks in the data->clk_id array are actually needed. The code already checks if the required clocks are available and bails out if not. The assumption that all clocks have to be present is wrong, and commit 9de2b9286a6d needs to be reverted. Fixes: 9de2b9286a6d ("ASoC: mediatek: Check for error clk pointer") Cc: Jiasheng Jiang Cc: Mark Brown Cc: James Liao Cc: Kevin Hilman Cc: Matthias Brugger Cc: Daniel Golle Link: https://lore.kernel.org/lkml/20220205014755.699603-1-linux@roeck-us.net/ Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/soc/mediatek/mtk-scpsys.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -411,17 +411,12 @@ out: return ret; } -static int init_clks(struct platform_device *pdev, struct clk **clk) +static void init_clks(struct platform_device *pdev, struct clk **clk) { int i; - for (i = CLK_NONE + 1; i < CLK_MAX; i++) { + for (i = CLK_NONE + 1; i < CLK_MAX; i++) clk[i] = devm_clk_get(&pdev->dev, clk_names[i]); - if (IS_ERR(clk[i])) - return PTR_ERR(clk[i]); - } - - return 0; } static struct scp *init_scp(struct platform_device *pdev, @@ -431,7 +426,7 @@ static struct scp *init_scp(struct platf { struct genpd_onecell_data *pd_data; struct resource *res; - int i, j, ret; + int i, j; struct scp *scp; struct clk *clk[CLK_MAX]; @@ -486,9 +481,7 @@ static struct scp *init_scp(struct platf pd_data->num_domains = num; - ret = init_clks(pdev, clk); - if (ret) - return ERR_PTR(ret); + init_clks(pdev, clk); for (i = 0; i < num; i++) { struct scp_domain *scpd = &scp->domains[i];