From: YueHaibing <yuehaibing@huawei.com>
To: <jk@ozlabs.org>, <joel@jms.id.au>, <eajames@linux.ibm.com>,
<andrew@aj.id.au>, <linux@roeck-us.net>
Cc: linux-aspeed@lists.ozlabs.org, alistair@popple.id.au,
YueHaibing <yuehaibing@huawei.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-fsi@lists.ozlabs.org
Subject: [PATCH v3 -next] fsi: aspeed: Fix aspeed device free
Date: Tue, 12 Nov 2019 11:47:44 +0800 [thread overview]
Message-ID: <20191112034744.10180-1-yuehaibing@huawei.com> (raw)
In-Reply-To: <20191109033634.30544-1-yuehaibing@huawei.com>
'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 <yuehaibing@huawei.com>
---
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;
}
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-11-12 3:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-09 3:32 [PATCH -next] fsi: aspeed: Use devm_kfree in aspeed_master_release() YueHaibing
2019-11-09 3:36 ` [PATCH v2 " YueHaibing
2019-11-11 14:17 ` Guenter Roeck
2019-11-12 3:47 ` YueHaibing [this message]
2019-11-11 14:16 ` [PATCH " Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191112034744.10180-1-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=alistair@popple.id.au \
--cc=andrew@aj.id.au \
--cc=eajames@linux.ibm.com \
--cc=jk@ozlabs.org \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-fsi@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).