Re: [PATCH] nvdimm-btt: simplify code with the scope based resource management

2023-12-13 Thread dinghao . liu
> > It's a little strange that we do not check super immediately after > > allocation. > > How about this: > > > > static int discover_arenas(struct btt *btt) > > { > > int ret = 0; > > struct arena_info *arena; > > - struct btt_sb *super; > > size_t remaining = bt

Re: [PATCH] nvdimm-btt: simplify code with the scope based resource management

2023-12-13 Thread Dave Jiang
On 12/12/23 20:12, dinghao@zju.edu.cn wrote: >> >> On 12/10/23 03:27, Dinghao Liu wrote: >>> Use the scope based resource management (defined in >>> linux/cleanup.h) to automate resource lifetime >>> control on struct btt_sb *super in discover_arenas(). >>> >>> Signed-off-by: Dinghao Liu >>

Re: [PATCH] nvdimm-btt: simplify code with the scope based resource management

2023-12-12 Thread dinghao . liu
> > On 12/10/23 03:27, Dinghao Liu wrote: > > Use the scope based resource management (defined in > > linux/cleanup.h) to automate resource lifetime > > control on struct btt_sb *super in discover_arenas(). > > > > Signed-off-by: Dinghao Liu > > --- > > drivers/nvdimm/btt.c | 12 >

Re: [PATCH] nvdimm-btt: simplify code with the scope based resource management

2023-12-11 Thread Dave Jiang
On 12/10/23 03:27, Dinghao Liu wrote: > Use the scope based resource management (defined in > linux/cleanup.h) to automate resource lifetime > control on struct btt_sb *super in discover_arenas(). > > Signed-off-by: Dinghao Liu > --- > drivers/nvdimm/btt.c | 12 > 1 file changed,

[PATCH] nvdimm-btt: simplify code with the scope based resource management

2023-12-10 Thread Dinghao Liu
Use the scope based resource management (defined in linux/cleanup.h) to automate resource lifetime control on struct btt_sb *super in discover_arenas(). Signed-off-by: Dinghao Liu --- drivers/nvdimm/btt.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/nv