Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1669344pxb; Wed, 9 Feb 2022 01:43:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrmmhnxh9BgcMfP2JXlctY2XHvMSIA7NfMfpTHLDxPssjXGlpx+JYpSLPPM9GuKOQc3Vow X-Received: by 2002:a17:902:bf4a:: with SMTP id u10mr1274530pls.113.1644399837924; Wed, 09 Feb 2022 01:43:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644399837; cv=none; d=google.com; s=arc-20160816; b=IBFfZxisTvLQSYmD6CrAx5m1+JbPhlhboA+N6MlVJJYfmQ4PUGtGvaNH/mDkAOimHT /l5+vO3MRwGe+tIkrdcXh/HTziSDatwUv330j8WEtFKfa2juwMmGH+/QHJiSbGy3RDK4 e2wpcJ001zzZn+9cXaphS1ZVP3XT0vMjm7BuTkDMvV+SEz4XCrZQv0yzr1rdFmojpyDI es8T1r3wXF4+g8SQ147J1yPhnnljjsA0aZKcskOx/eg0C03+C3F/zQ6l8jHha5yth6jQ H0nn9bNRh7vzYYarrsqMeYfs94+/9SVij/c0Pj/WXZyw8LP2IvtH8BCVbifPhFs9Hqe8 aP3w== 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=Zv4oHK5cT4/0Jc9k09BW0E5zBzmIWVstfFIhKBiqIWg=; b=FGoFjcH7W77Z9KddEvJ1hB4Sk+WkGo6ge0Uq7EZm2IPLGw7adfzwsrZO+KKCbJRJNM o4qSSSdvdVl/xDoB15arGADWvn4ce+EwlfTaFBR0HmQutF1ZEyo8/4F3DvfHFphwlbW2 T0Mv9gG+bP/jKg1MsqMo1vrtLmKFn+ZqELhWnWgAicf9+y/EzxxbrL+3fG+hc+NCpSQ2 rrKMcGtuUNgWjE68B4uOdhwmYSG9Es4Gexv9Q2IfPRdB1ssjMntrkX/mF2lP1NpnAnX1 4JugJV+u1mR0Uky3cngv0U/ItsWYnmcd76AGjNncqysd8Q6FP6JQtpFjVpTtZ/NWN1NV 9LVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pFDLn3Ar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t186si14912008pgd.805.2022.02.09.01.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:43:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pFDLn3Ar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EE477E0385D1; Wed, 9 Feb 2022 01:06:05 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388481AbiBGLnq (ORCPT + 99 others); Mon, 7 Feb 2022 06:43:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385729AbiBGLcT (ORCPT ); Mon, 7 Feb 2022 06:32:19 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18EF5C043189; Mon, 7 Feb 2022 03:32:18 -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 7B4F660A67; Mon, 7 Feb 2022 11:32:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 611B5C004E1; Mon, 7 Feb 2022 11:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233537; bh=idzC9wTmQOAG07iR2RbTzqlDGaG9udT+X4x1GRMFd3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pFDLn3ArROto2tlYpRvyyvibYk2eozmsvmRJ6dEO8G/QR51U0oDMrft2s3pTv2QIP hvyFFWpoiJ3Fn5u9n7cYZWa+2bc5yxQoSAMAqNlxwSbwM2ZlUMKO0EqrvH3YOqJrbc 7dOB2YtvYlGla8t+wbSLjscrllnAgbcphp8f+bts= 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.16 043/126] [PATCH] Revert "ASoC: mediatek: Check for error clk pointer" Date: Mon, 7 Feb 2022 12:06:14 +0100 Message-Id: <20220207103805.609153851@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103804.053675072@linuxfoundation.org> References: <20220207103804.053675072@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 e0bf3c9e05ca6837ac756ec7d9de70b44603da12 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];