Commit 5b9d3974 authored by Jeff Moyer's avatar Jeff Moyer Committed by Martin K. Petersen

scsi: sg: clean up gfp_mask in sg_build_indirect

commit a45b599a ("scsi: sg: allocate with __GFP_ZERO in
sg_build_indirect()") changed the call to alloc_pages to always use
__GFP_ZERO.  Just above that, though, there was this:

       if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
               gfp_mask |= __GFP_ZERO;

And there's only one user of the gfp_mask.  Just or in the __GFP_ZERO
flag at the top of the function and be done with it.
Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b3a8aa90
...@@ -1850,7 +1850,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) ...@@ -1850,7 +1850,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
int ret_sz = 0, i, k, rem_sz, num, mx_sc_elems; int ret_sz = 0, i, k, rem_sz, num, mx_sc_elems;
int sg_tablesize = sfp->parentdp->sg_tablesize; int sg_tablesize = sfp->parentdp->sg_tablesize;
int blk_size = buff_size, order; int blk_size = buff_size, order;
gfp_t gfp_mask = GFP_ATOMIC | __GFP_COMP | __GFP_NOWARN; gfp_t gfp_mask = GFP_ATOMIC | __GFP_COMP | __GFP_NOWARN | __GFP_ZERO;
struct sg_device *sdp = sfp->parentdp; struct sg_device *sdp = sfp->parentdp;
if (blk_size < 0) if (blk_size < 0)
...@@ -1880,9 +1880,6 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) ...@@ -1880,9 +1880,6 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
if (sdp->device->host->unchecked_isa_dma) if (sdp->device->host->unchecked_isa_dma)
gfp_mask |= GFP_DMA; gfp_mask |= GFP_DMA;
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
gfp_mask |= __GFP_ZERO;
order = get_order(num); order = get_order(num);
retry: retry:
ret_sz = 1 << (PAGE_SHIFT + order); ret_sz = 1 << (PAGE_SHIFT + order);
...@@ -1893,7 +1890,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) ...@@ -1893,7 +1890,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
num = (rem_sz > scatter_elem_sz_prev) ? num = (rem_sz > scatter_elem_sz_prev) ?
scatter_elem_sz_prev : rem_sz; scatter_elem_sz_prev : rem_sz;
schp->pages[k] = alloc_pages(gfp_mask | __GFP_ZERO, order); schp->pages[k] = alloc_pages(gfp_mask, order);
if (!schp->pages[k]) if (!schp->pages[k])
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment