From patchwork Tue Nov 12 03:47:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 1193356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47BzRF2PpTz9sPJ for ; Tue, 12 Nov 2019 18:10:33 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=huawei.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47BzRF1Cv2zF5Gg for ; Tue, 12 Nov 2019 18:10:33 +1100 (AEDT) X-Original-To: linux-fsi@lists.ozlabs.org Delivered-To: linux-fsi@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=45.249.212.32; helo=huawei.com; envelope-from=yuehaibing@huawei.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=huawei.com Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47Btzl4Rs0zF4h0; Tue, 12 Nov 2019 14:49:51 +1100 (AEDT) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 72B4782E77B507D15B6E; Tue, 12 Nov 2019 11:49:46 +0800 (CST) Received: from localhost (10.133.213.239) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Tue, 12 Nov 2019 11:49:37 +0800 From: YueHaibing To: , , , , Subject: [PATCH v3 -next] fsi: aspeed: Fix aspeed device free Date: Tue, 12 Nov 2019 11:47:44 +0800 Message-ID: <20191112034744.10180-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 In-Reply-To: <20191109033634.30544-1-yuehaibing@huawei.com> References: <20191109033634.30544-1-yuehaibing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.133.213.239] X-CFilter-Loop: Reflected X-Mailman-Approved-At: Tue, 12 Nov 2019 18:10:30 +1100 X-BeenThere: linux-fsi@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aspeed@lists.ozlabs.org, alistair@popple.id.au, YueHaibing , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org Errors-To: linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "linux-fsi" 'aspeed' is allocted by devm_kfree(), it should not be kfree(). In fact it will be freed while the device released. Also we grap reference after fsi_master_register() success, so should put it in fsi_master_aspeed_remove(). Fixes: 1edac1269c02 ("fsi: Add ast2600 master driver") Signed-off-by: YueHaibing --- v3: remove unneeded release() and put last reference v2: fix log typos --- drivers/fsi/fsi-master-aspeed.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index f49742b..01a7f24 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -350,14 +350,6 @@ static int aspeed_master_break(struct fsi_master *master, int link) return aspeed_master_write(master, link, 0, addr, &cmd, 4); } -static void aspeed_master_release(struct device *dev) -{ - struct fsi_master_aspeed *aspeed = - to_fsi_master_aspeed(dev_to_fsi_master(dev)); - - kfree(aspeed); -} - /* mmode encoders */ static inline u32 fsi_mmode_crs0(u32 x) { @@ -483,7 +475,6 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) dev_info(&pdev->dev, "hub version %08x (%d links)\n", reg, links); aspeed->master.dev.parent = &pdev->dev; - aspeed->master.dev.release = aspeed_master_release; aspeed->master.dev.of_node = of_node_get(dev_of_node(&pdev->dev)); aspeed->master.n_links = links; @@ -522,6 +513,7 @@ static int fsi_master_aspeed_remove(struct platform_device *pdev) fsi_master_unregister(&aspeed->master); clk_disable_unprepare(aspeed->clk); + put_device(&aspeed->master.dev); return 0; }