diff options
author | Alexander Vickberg <wickbergster@gmail.com> | 2025-04-10 13:37:40 +0200 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2025-05-05 10:15:43 +0200 |
commit | c81d8efb51480b318f0bd0a3bdf2d5b0445bbbc9 (patch) | |
tree | 81f0b92974d4bd475ddb0fdf094e894e13cf81e7 | |
parent | 9dbe8d889546efd6c1a3470092588b9b6820158f (diff) |
mtd: ubi: Put MTD device after it is not used
The MTD device reference is dropped via put_mtd_device, however its
field ->index is read and passed to ubi_msg. To fix this, the patch
moves the reference dropping after calling ubi_msg.
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Upstream Linux commit: b95f83ab762dd6211351b9140f99f43644076ca8
Signed-off-by: Alexander Vickberg <wickbergster@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
-rw-r--r-- | drivers/mtd/ubi/build.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 50e43928af0..4881287dd6b 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -1152,10 +1152,10 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) ubi_wl_close(ubi); ubi_free_internal_volumes(ubi); vfree(ubi->vtbl); - put_mtd_device(ubi->mtd); vfree(ubi->peb_buf); vfree(ubi->fm_buf); ubi_msg(ubi, "mtd%d is detached", ubi->mtd->index); + put_mtd_device(ubi->mtd); put_device(&ubi->dev); return 0; } |