From patchwork Sun Dec 26 16:56:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 1577691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JXH2x4P3Xz9sRR for ; Mon, 10 Jan 2022 12:55:21 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JXH2x2D11z30JB for ; Mon, 10 Jan 2022 12:55:21 +1100 (AEDT) X-Original-To: linux-fsi@lists.ozlabs.org Delivered-To: linux-fsi@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=wanadoo.fr (client-ip=80.12.242.132; helo=smtp.smtpout.orange.fr; envelope-from=christophe.jaillet@wanadoo.fr; receiver=) Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr [80.12.242.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JMRw46gjxz2xsJ for ; Mon, 27 Dec 2021 04:03:46 +1100 (AEDT) Received: from pop-os.home ([86.243.171.122]) by smtp.orange.fr with ESMTPA id 1WoWnyraJ3ptZ1WoXnZEua; Sun, 26 Dec 2021 17:56:12 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 26 Dec 2021 17:56:12 +0100 X-ME-IP: 86.243.171.122 From: Christophe JAILLET To: jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, eajames@linux.ibm.com, andrew@aj.id.au, gregkh@linuxfoundation.org Subject: [PATCH] fsi: Aspeed: Fix a potential double free Date: Sun, 26 Dec 2021 17:56:02 +0100 Message-Id: <2cafa0607ca171ebd00ac6c7e073b46808e24f00.1640537669.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 10 Jan 2022 12:51:44 +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, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Christophe JAILLET , 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 a devm_alloc'ed, so there is no need to free it explicitly or there will be a double free(). Remove the 'release' function that is wrong and unneeded. Fixes: 606397d67f41 ("fsi: Add ast2600 master driver") Signed-off-by: Christophe JAILLET --- This patch is completely theoretical. It looks good to me, but there is a little too much indirections for me. I'm also not that familiar with fixing issue related to 'release' function... ... So review with care :) --- drivers/fsi/fsi-master-aspeed.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 8606e55c1721..4a745ccb60cf 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -373,14 +373,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) { @@ -603,7 +595,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;