Dear Dan Carpenter, I know what you wrote, but before device is removed and freed memory automatically, programming pages may do many many times. Assume we erase and rewrite a large part of the flash, then spinand_program_page() might exhaust memory if memory is not large enough. In fact, OOM indeed occured when I tested programming multi-pages by mtd_debug tool. If OOM was not caused by devm_kzalloc() in spinand_program_page(), what may exhaust memory?
*Best Regards,* *─────────────────────────* *Jheng-Jhong Wu (Victor Wu)* *E-mail: goodwater...@gmail.com <goodwater...@gmail.com>* *─────────────────────────* Dan Carpenter <dan.carpen...@oracle.com> 於 2018年8月1日 週三 下午7:45寫道: > devm_ resources are freed automatically when the device is removed. > The name devm_ stands for "device" and "managed". > > regards, > dan carpenter > >