Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp735041pxb; Thu, 5 Nov 2020 11:32:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvW83hXZP/2Nha8EfsIqzCsSHyTLb2UWQtKrU+NISt/FvU/krJsHQP992DBenyMe5V5dCD X-Received: by 2002:a50:9e05:: with SMTP id z5mr4103555ede.231.1604604723184; Thu, 05 Nov 2020 11:32:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604604723; cv=none; d=google.com; s=arc-20160816; b=NOLnrVOnTgBWf0a8nJBaZrsXRSzDzCvbn/DSN5UOfIqgImOszZoatuCL48IAtrPX1b HGqSltrdndtCpH44yhKais9dfYbWuSeqbgxotAJN4gDDA8vP61epOMTKDqItzPo4jO2t gCtHaM/k0fXmOPEEScoM/rDhZZEiFzHe1K5rpIejfti7GopXVITTaOPVnNV5N/MM3cTE BL2Q+N9X14muHHIDAeWJ2b79ZMj+UPXqeAn7apKn3lH0jQ7tzai+PeBHZ9mtOOWbfKx0 HMut2OVlUUBrghMf8V7BDAZUlUo0UK1fS3lu7XB/mKPfKm+FtFZ3ceJE6Urk/OkhRUD6 YcwQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BJUkw8AYCQNrkkeOu2MyIFkOGcO1y97EQdUOLW9XW04=; b=M1U7Ow0D18lUp17uFh10v5muj9ErtT5irobv9AHTXw4e6qvmOBWTlsSJd/L5+531C/ TgCR5aRuwvHJsrIh14pYOK/Da2Sm3zkghGkxwiSgAP/TqZNILiWbVLmFjRT1Pq0vi5/p ueE1lgXt3B7VYmuHZTYN9/DItMzhHR5piybnV8lXh1+CBqkTbnMGhNi+7BcVzCzaqGOJ qO7y2bnGGveJX9kHZ+Ft6VxF2Y4g+P6Ibl/o78BNMU+qfizEkdpJm4a0Gbi2OWRSfDAW HmLXLOnHT7XwzeVERNIusHvlkRNlbF5QQffwbILtk17TBWbYU5j9Nhmn52eqhSMoR2NV ETwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=M0t6T4ai; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m14si1849642ejr.448.2020.11.05.11.31.40; Thu, 05 Nov 2020 11:32:03 -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=@walle.cc header.s=mail2016061301 header.b=M0t6T4ai; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732224AbgKET2J (ORCPT + 99 others); Thu, 5 Nov 2020 14:28:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732133AbgKET17 (ORCPT ); Thu, 5 Nov 2020 14:27:59 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2AF9C0613CF; Thu, 5 Nov 2020 11:27:58 -0800 (PST) Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id D87D622F9C; Thu, 5 Nov 2020 20:27:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1604604475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BJUkw8AYCQNrkkeOu2MyIFkOGcO1y97EQdUOLW9XW04=; b=M0t6T4aitrk00/hTfbhvJ0WA4UcvYl2yeWIlQrTViAZ3bOC1lxk+Kjvh7s3Z2hZJ2YJW+X LpoO+Cbq5eEVayXjbYE0D2bqBlADpgm2fHRvEu4nSMo0fnyG+C0q2wBNlsJ0cddHJBI9hz eIX5ErrV5ELOz96oOXLDTjsQM9tLBKE= From: Michael Walle To: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stephen Boyd , Michael Turquette , Michael Walle Subject: [PATCH v2 1/3] clk: fsl-sai: fix memory leak Date: Thu, 5 Nov 2020 20:27:44 +0100 Message-Id: <20201105192746.19564-2-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201105192746.19564-1-michael@walle.cc> References: <20201105192746.19564-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the device is removed we don't unregister the composite clock. Fix that. Fixes: 9cd10205227c ("clk: fsl-sai: new driver") Signed-off-by: Michael Walle --- Changes since v1: - none drivers/clk/clk-fsl-sai.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/clk/clk-fsl-sai.c b/drivers/clk/clk-fsl-sai.c index 0221180a4dd7..1e81c8d8a6fd 100644 --- a/drivers/clk/clk-fsl-sai.c +++ b/drivers/clk/clk-fsl-sai.c @@ -68,9 +68,20 @@ static int fsl_sai_clk_probe(struct platform_device *pdev) if (IS_ERR(hw)) return PTR_ERR(hw); + platform_set_drvdata(pdev, hw); + return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); } +static int fsl_sai_clk_remove(struct platform_device *pdev) +{ + struct clk_hw *hw = platform_get_drvdata(pdev); + + clk_hw_unregister_composite(hw); + + return 0; +} + static const struct of_device_id of_fsl_sai_clk_ids[] = { { .compatible = "fsl,vf610-sai-clock" }, { } @@ -79,6 +90,7 @@ MODULE_DEVICE_TABLE(of, of_fsl_sai_clk_ids); static struct platform_driver fsl_sai_clk_driver = { .probe = fsl_sai_clk_probe, + .remove = fsl_sai_clk_remove, .driver = { .name = "fsl-sai-clk", .of_match_table = of_fsl_sai_clk_ids, -- 2.20.1