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 <[email protected]>
---
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
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 <[email protected]>
> ---
> 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 <[email protected]>
--
Thanks,
David / dhildenb