[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2MqH+EdN7wX1vcl@google.com>
Date: Thu, 3 Nov 2022 11:40:31 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Minchan Kim <minchan@...nel.org>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Nitin Gupta <ngupta@...are.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCHv4 1/9] zram: Preparation for multi-zcomp support
On (22/11/02 13:13), Minchan Kim wrote:
[..]
> >
> > +static void zram_destroy_comps(struct zram *zram)
> > +{
> > + u32 idx;
> > +
> > + for (idx = 0; idx < ZRAM_MAX_ZCOMPS; idx++) {
> > + struct zcomp *comp = zram->comps[idx];
> > +
> > + zram->comps[idx] = NULL;
> > + if (IS_ERR_OR_NULL(comp))
>
> nit:
>
> Why don't you use just NULL check? I don't see any error setting
> for zram->comps(Maybe later patch? Will keep check)?
A defense measure. zcomp_create() returns err pointer, so here
I check for err and nil just in case (if somehow someday we
accidentally have err values stored in comps). It's cheap and
safer than NULL.
Powered by blists - more mailing lists