From: Xiang W Date: Thu, 9 Mar 2023 10:35:28 +0000 (+0800) Subject: lib: sbi_scratch: Optimize the alignment code for alloc size X-Git-Tag: v1.3~63 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed88a63b90249c570c7f1f123e979f6f5faf657a;p=platform%2Fkernel%2Fopensbi-spacemit.git lib: sbi_scratch: Optimize the alignment code for alloc size Signed-off-by: Xiang W Reviewed-by: Anup Patel --- diff --git a/lib/sbi/sbi_scratch.c b/lib/sbi/sbi_scratch.c index 87b34c6..55ebdbb 100644 --- a/lib/sbi/sbi_scratch.c +++ b/lib/sbi/sbi_scratch.c @@ -59,8 +59,8 @@ unsigned long sbi_scratch_alloc_offset(unsigned long size) if (!size) return 0; - if (size & (__SIZEOF_POINTER__ - 1)) - size = (size & ~(__SIZEOF_POINTER__ - 1)) + __SIZEOF_POINTER__; + size += __SIZEOF_POINTER__ - 1; + size &= ~((unsigned long)__SIZEOF_POINTER__ - 1); spin_lock(&extra_lock);