* [PATCH] mm/swapfile: Remove needless request_queue NULL pointer check
@ 2021-09-17 8:21 Xu Wang
2021-09-22 11:24 ` David Hildenbrand
0 siblings, 1 reply; 2+ messages in thread
From: Xu Wang @ 2021-09-17 8:21 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel
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;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/swapfile: Remove needless request_queue NULL pointer check
2021-09-17 8:21 [PATCH] mm/swapfile: Remove needless request_queue NULL pointer check Xu Wang
@ 2021-09-22 11:24 ` David Hildenbrand
0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2021-09-22 11:24 UTC (permalink / raw)
To: Xu Wang, akpm; +Cc: linux-mm, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-22 11:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.