From: Dan Carpenter <dan.carpenter@oracle.com>
To: Xiongwei Song <sxwjean@gmail.com>
Cc: gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com,
maco@android.com, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: android: check the return value of register_shrinker
Date: Thu, 4 Jan 2018 17:55:22 +0300 [thread overview]
Message-ID: <20180104145522.ru7twjwzmzzrqatd@mwanda> (raw)
In-Reply-To: <20180104000853.1142-1-sxwjean@gmail.com>
On Thu, Jan 04, 2018 at 08:08:53AM +0800, Xiongwei Song wrote:
> register_shrinker call is made in ashmem_init, it may return error code,
> so we need to check it.
>
> Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
> ---
> drivers/staging/android/ashmem.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 4e8947923904..0b23c3e25cd4 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -854,12 +854,18 @@ static int __init ashmem_init(void)
> goto out_free2;
> }
>
> - register_shrinker(&ashmem_shrinker);
> + ret = register_shrinker(&ashmem_shrinker);
> + if (unlikely(ret)) {
Don't add the unlikely() here. It hurts readability and this is not a
fast path. I know the other callers all have it... :/
regards,
dan carpenter
next prev parent reply other threads:[~2018-01-04 14:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 0:08 Xiongwei Song
2018-01-04 14:55 ` Dan Carpenter [this message]
2018-01-04 15:15 ` Xiongwei Song
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=20180104145522.ru7twjwzmzzrqatd@mwanda \
--to=dan.carpenter@oracle.com \
--cc=arve@android.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=sxwjean@gmail.com \
--cc=tkjos@android.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
all inboxes | Powered by JetHome®