ubi fixes for v2025.07-rc2

- fix bug: Put MTD device after it is not used
  drop MTD device reference after it is not longer used!
  port from upstream Linux commit: b95f83ab762dd6211351b9140f99f43644076ca8
  from Alexander Vickberg
This commit is contained in:
Tom Rini 2025-05-05 07:54:30 -06:00
commit 3f519d93c1

View File

@ -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;
}