Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1133822rwi; Wed, 19 Oct 2022 07:07:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qe/3S25jOyYhwOjEQSQKubH9wiO0nA7PL6XBNY5ptz2O3TagO3YtB0K73+SzuMO1KfiRd X-Received: by 2002:a17:907:7f07:b0:779:7f94:d259 with SMTP id qf7-20020a1709077f0700b007797f94d259mr6820114ejc.525.1666188469575; Wed, 19 Oct 2022 07:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188469; cv=none; d=google.com; s=arc-20160816; b=TM4mtV8XAlE0toIa1mWM6QScWdUzJdEiI1P4yrSE2jVoP9NlQRpC/XjjfJboM/3PO5 cjAFhWFsDRzQLUBxSRnjyXm46aWl/Z3PiCxIpfr6THxBzqqtTP3PyycKtoaBdrKDnpmM NP8tUXjLMwktPBsBRoTeOL0j9mytrLKRZjqG7mPQnIZP8CLmwCHKFdboTBPIRSr9/7Fp Tmg1qTLin8ppekVRL0zzCI5Tz4yKAhVscCTv2DjXmRFApGc11lVJ8TI5U0e02YFcc+ki CgiTqNJzgiBlZw8GH6bh9jSv+U4375VlvK3XxU4l2WSM2AYg4WEkFyFwwcPLiu6Z0uHx ZxoA== 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=78Kc8w8ydrkkfPYB4fmn7aG3ncQJYMfXAfQX4Guliqg=; b=VnPJ4S26wEI7eakXloZUmvkOu75ff/cKegXZgbo1DlVy4/R/RpnwhbBE+lVqB3RVk4 9hGL9B6be3/W0crE3RQzTg2iLutiAiul7dbTWLBQyYkQBVVEB2tv623KT6awiyLw02o6 aclkRZBjQ1fC3mYlImafP08fOLEU5501VavY7cCE4F9sf6DndfYedqTxLhOehwVHmPEY lc2NHzQRqNc6vsRRgpf6HIIW9Z54iikPwgWjHVqOC9oTBvTg1kUR7TWEXRYkC/TWrCl0 wdvxr1kpsjBXXCeYLriAZlI/8tf5LBgiJlNmFlNc7q4ode0q4vcSiWEuHYldKub191z5 cyYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EPUtDqQ3; 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 qw20-20020a1709066a1400b0078dad5e8d65si13035327ejc.68.2022.10.19.07.07.23; Wed, 19 Oct 2022 07:07:49 -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=EPUtDqQ3; 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 S232707AbiJSNjd (ORCPT + 99 others); Wed, 19 Oct 2022 09:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232732AbiJSNi5 (ORCPT ); Wed, 19 Oct 2022 09:38:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1531DEC08; Wed, 19 Oct 2022 06:26:37 -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 2561EB82474; Wed, 19 Oct 2022 09:04:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E7C1C433C1; Wed, 19 Oct 2022 09:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170248; bh=wZRJP6DZHyUxGwtrN/A53yev+G+r02XBhhxY+GvCr8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPUtDqQ3NnqPFS0XkejD7Xfr9LDtKD7flCzh3qV1blWRCqq8AteRtTTFLiQ+FEFXF Os7pXmHAtFiNceNKE+nzn+8vZD5+ysGyADAqrDJCGtj0eg+btxYFD7wcD1ympPunGe Exri3Z0CzVM3PZHfF3u/5EZGwQwcUTCmgoUksYb4= 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 6.0 583/862] clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup Date: Wed, 19 Oct 2022 10:31:10 +0200 Message-Id: <20221019083315.728009225@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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 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 05a188c62119..9b82956260d3 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); } -- 2.35.1