mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
crypto: rockchip: utils: optimize alignment criteria
There is no length alignment requirement for the last scatterlist. Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com> Change-Id: I9625bce9379cef4c1a8507ba523f5f303d60c9e6
This commit is contained in:
@@ -72,14 +72,18 @@ static int check_scatter_align(struct scatterlist *sg_src,
|
||||
{
|
||||
int in, out, align;
|
||||
|
||||
/* The last piece has no need for length alignment */
|
||||
in = IS_ALIGNED((u32)sg_src->offset, 4) &&
|
||||
IS_ALIGNED((u32)sg_src->length, align_mask) &&
|
||||
(!sg_next(sg_src) ||
|
||||
IS_ALIGNED((u32)sg_src->length, align_mask)) &&
|
||||
(sg_phys(sg_src) < SZ_4G);
|
||||
if (!sg_dst)
|
||||
return in;
|
||||
|
||||
/* The last piece has no need for length alignment */
|
||||
out = IS_ALIGNED((u32)sg_dst->offset, 4) &&
|
||||
IS_ALIGNED((u32)sg_dst->length, align_mask) &&
|
||||
(!sg_next(sg_dst) ||
|
||||
IS_ALIGNED((u32)sg_dst->length, align_mask)) &&
|
||||
(sg_phys(sg_dst) < SZ_4G);
|
||||
align = in && out;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user