From patchwork Sat Oct 22 07:25:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109518wrr; Sat, 22 Oct 2022 01:48:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6h3QtoJNBA+VoU2RIdZOBX6x0lZ8xWgeS4zVcDeuyXHS1qB8GEeTm1mAS9cP5SS3g9Yllh X-Received: by 2002:a05:6402:50cc:b0:45c:ec07:c394 with SMTP id h12-20020a05640250cc00b0045cec07c394mr21446605edb.411.1666428532773; Sat, 22 Oct 2022 01:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428532; cv=none; d=google.com; s=arc-20160816; b=AQKmST6s8GPOmKUdSsoegZE3IkpWw3PBfKOq1ITrCDAJJin5SfgZZ4sLawfxE83aqj q9+5K8/zKbJWDlz9BYwprUHbCSoMqXMTpM+z/ksO7nIacZfE8afzfykS+Dw2b4kRPQvQ 4n5rWbgEpcGaISMHNuuperkKiFfFuK/5oy7NWXzN6JxKy2M2XGERO1eUPxken958Etki nRbnT+VkmlT2XT+uIX21EZAl37BqcEZuyZAJefxArXO3WOuedD64efDvL1WqagkcKp8r 7ksMa5fWzQ/kRpbEVaktxh6TNO8m28NmQByVTPXTq1KtiF6zecwuBq5hgvyLccMKdhoZ Wa4w== 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=aT5O6DUItw/raRyKdLWyta/Gtx3jTLQSKYL8S6gspHY=; b=gGplWc7l/grKl8TTMHz00SGENBBGajUWufEiTgqOZNn0rE3yjpnJ4BI68gU+YFqc8T Gsx+yHicJsB8EudZtKT+wOp3wGQ6NgOzumQR/KkC8woMHHwrJFkS6MDAMDGefxD+Orvz Zt8bq3VaR5iwuaw7DvS0S7hV2FDf3qNxcCzVcEbY2Qx3sqcL+9C47MiyxOM8OvKiXTEX vo0jjDHThtYtnEhROMb3DE5beRNLJM4UOsQpOSewNJEkdZA6Y/mtmQ0XEvFUhQZC6MrX yO0LAZnnaMLNX6tP+eXExeDOU9ddR2k4y55uN6Pmi1Vd+cdV/+ZV2LBn9ZZZaoq5nkvP tNWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aZWkGUSD; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z22-20020a05640240d600b0045d5a712e82si20784922edb.586.2022.10.22.01.48.28; Sat, 22 Oct 2022 01:48:52 -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=aZWkGUSD; 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 S231571AbiJVIr6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235232AbiJVIpA (ORCPT ); Sat, 22 Oct 2022 04:45:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE8822ECF44; Sat, 22 Oct 2022 01:08: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 3825E60B9E; Sat, 22 Oct 2022 07:56:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41333C43142; Sat, 22 Oct 2022 07:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425359; bh=mCt10wEUGdkbYKVqsikirEnFY/fRySLGrPNv1mk+zm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZWkGUSDTg2C3+RurIScZZU07UIY3w8SO46LaQQ0h+h0MPIGGX80dpXtbl6MMBIkI kemOBnyTiE7mjGM/mVA1Kq5kQ658bMlmHoWP2P9idXXFkdYuan0ZurLNdzE3GiSkA7 UxAOlzELzqgkphI0DyleICPlzfmurXKDpsIRQ0uA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Chen-Yu Tsai , Sasha Levin Subject: [PATCH 5.19 475/717] clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup Date: Sat, 22 Oct 2022 09:25:54 +0200 Message-Id: <20221022072519.358479275@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376965347434752?= X-GMAIL-MSGID: =?utf-8?q?1747376965347434752?= From: Chen-Yu Tsai [ Upstream commit 20f7a0dba9075fb0e3d645495bc24d7025b58de1 ] When the cleanup paths for the various clk register APIs in the MediaTek clk library were added, the one in the dividers type used the wrong type of unregister function. This would result in incorrect dereferencing of the clk pointer and freeing of invalid pointers. Fix this by switching to the correct type of clk unregistration call. Fixes: 3c3ba2ab0226 ("clk: mediatek: mtk: Implement error handling in register APIs") Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220926102523.2367530-2-wenst@chromium.org Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mtk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index b9188000ab3c..53bb8b88332f 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -393,7 +393,7 @@ int mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, int num, if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) continue; - mtk_clk_unregister_composite(clk_data->hws[mcd->id]); + clk_hw_unregister_divider(clk_data->hws[mcd->id]); clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); }