mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mtd: rawnand: fsl_ifc: use devm_kasprintf for mtd name
Replace the manual kasprintf() in probe with devm_kasprintf() so the name is freed automatically on driver removal, and drop the now unnecessary kfree() in fsl_ifc_chip_remove() and its leftover mtd local. Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
5e73728a87
commit
44c7b273e6
|
|
@ -964,10 +964,6 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
|
|||
|
||||
static int fsl_ifc_chip_remove(struct fsl_ifc_mtd *priv)
|
||||
{
|
||||
struct mtd_info *mtd = nand_to_mtd(&priv->chip);
|
||||
|
||||
kfree(mtd->name);
|
||||
|
||||
ifc_nand_ctrl->chips[priv->bank] = NULL;
|
||||
|
||||
return 0;
|
||||
|
|
@ -1064,7 +1060,7 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
|
|||
&ifc->ifc_nand.nand_evter_intr_en);
|
||||
|
||||
mtd = nand_to_mtd(&priv->chip);
|
||||
mtd->name = kasprintf(GFP_KERNEL, "%llx.flash", (u64)res->start);
|
||||
mtd->name = devm_kasprintf(priv->dev, GFP_KERNEL, "%llx.flash", (u64)res->start);
|
||||
if (!mtd->name) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user