diff options
| author | Alexander Vickberg <[email protected]> | 2025-04-10 13:37:40 +0200 |
|---|---|---|
| committer | Heiko Schocher <[email protected]> | 2025-05-05 10:15:43 +0200 |
| commit | c81d8efb51480b318f0bd0a3bdf2d5b0445bbbc9 (patch) | |
| tree | 81f0b92974d4bd475ddb0fdf094e894e13cf81e7 /drivers | |
| 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 <[email protected]>
Reviewed-by: Boris Brezillon <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
Upstream Linux commit: b95f83ab762dd6211351b9140f99f43644076ca8
Signed-off-by: Alexander Vickberg <[email protected]>
Reviewed-by: Heiko Schocher <[email protected]>
Diffstat (limited to 'drivers')
| -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; } |
