[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5c62b668.34d1b.18c673eaeb5.Coremail.dinghao.liu@zju.edu.cn>
Date: Thu, 14 Dec 2023 15:33:30 +0800 (GMT+08:00)
From: dinghao.liu@....edu.cn
To: "Dave Jiang" <dave.jiang@...el.com>
Cc: "Vishal Verma" <vishal.l.verma@...el.com>,
"Dan Williams" <dan.j.williams@...el.com>,
"Ira Weiny" <ira.weiny@...el.com>, nvdimm@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] nvdimm-btt: simplify code with the scope based resource
management
> > 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 = btt->rawsize;
> > u64 cur_nlba = 0;
> > size_t cur_off = 0;
> > int num_arenas = 0;
> >
> > - super = kzalloc(sizeof(*super), GFP_KERNEL);
> > + struct btt_sb *super __free(kfree) =
> > + kzalloc(sizeof(*super), GFP_KERNEL);
> > if (!super)
> > return -ENOMEM;
> >
> > while (remaining) {
> >
>
> That's fine by me
I will resend a new patch soon, thanks!
Regards,
Dinghao
Powered by blists - more mailing lists