linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
	sergey.senozhatsky.work@gmail.com, Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH v2] mm: zsmalloc: Replace return type int with bool
Date: Wed, 21 Feb 2018 13:04:19 +0100	[thread overview]
Message-ID: <20180221120419.GE2231@dhcp22.suse.cz> (raw)
In-Reply-To: <CAFqt6za=iGsXKa=2dfjOq=7fKy+BxAq_=08=OYPmAy8GwugXAA@mail.gmail.com>

On Wed 21-02-18 16:48:50, Souptick Joarder wrote:
> On Wed, Feb 21, 2018 at 3:52 PM, Michal Hocko <mhocko@kernel.org> wrote:
> > On Tue 20-02-18 23:28:11, Souptick Joarder wrote:
> > [...]
> >> -static int zs_register_migration(struct zs_pool *pool)
> >> +static bool zs_register_migration(struct zs_pool *pool)
> >>  {
> >>       pool->inode = alloc_anon_inode(zsmalloc_mnt->mnt_sb);
> >>       if (IS_ERR(pool->inode)) {
> >>               pool->inode = NULL;
> >> -             return 1;
> >> +             return true;
> >>       }
> >>
> >>       pool->inode->i_mapping->private_data = pool;
> >>       pool->inode->i_mapping->a_ops = &zsmalloc_aops;
> >> -     return 0;
> >> +     return false;
> >>  }
> >
> > Don't you find it a bit strange that the function returns false on
> > success?
> 
> The original code was returning 0 on success  and return value was handled
> accordingly in zs_create_pool(). So returning false on success.

Returning 0 on success and an error code on failure is a standard
convention. Returning false is just weird. zs_register_migration is
somewhere in the middle because it doesn't really return an error code
on failure. Whether this is worth bothering and fixing is a question for
the maintainer but returning false on success is just not an improvement
IMHO.

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2018-02-21 12:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 17:58 [PATCH v2] mm: zsmalloc: Replace return type int with bool Souptick Joarder
2018-02-21 10:22 ` Michal Hocko
2018-02-21 11:18   ` Souptick Joarder
2018-02-21 12:04     ` Michal Hocko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180221120419.GE2231@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=jrdr.linux@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).