linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Xu Wang <vulab@iscas.ac.cn>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/swapfile: Remove needless request_queue NULL pointer check
Date: Wed, 22 Sep 2021 13:24:37 +0200	[thread overview]
Message-ID: <8327ab0b-a6f4-7580-fb79-b079500c26fe@redhat.com> (raw)
In-Reply-To: <20210917082111.33923-1-vulab@iscas.ac.cn>

On 17.09.21 10:21, Xu Wang wrote:
> The request_queue pointer returned from bdev_get_queue() shall
> never be NULL, so the null check is unnecessary, just remove it.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>   mm/swapfile.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 22d10f713848..42027d213fd2 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -3118,7 +3118,7 @@ static bool swap_discardable(struct swap_info_struct *si)
>   {
>   	struct request_queue *q = bdev_get_queue(si->bdev);
>   
> -	if (!q || !blk_queue_discard(q))
> +	if (!blk_queue_discard(q))
>   		return false;
>   
>   	return true;
> 

Right, there is even a comment in bdev_get_queue "this is never NULL".

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



      reply	other threads:[~2021-09-22 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  8:21 [PATCH] mm/swapfile: Remove needless request_queue NULL pointer check Xu Wang
2021-09-22 11:24 ` David Hildenbrand [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=8327ab0b-a6f4-7580-fb79-b079500c26fe@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vulab@iscas.ac.cn \
    /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).