diff options
| author | Xiang W <[email protected]> | 2023-03-09 18:35:28 +0800 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-04-06 16:00:45 +0530 |
| commit | ed88a63b90249c570c7f1f123e979f6f5faf657a (patch) | |
| tree | d1753abce580edffdd34f3a0ed72d39c30bfc6a9 | |
| parent | c6a092cd80112529cb2e92e180767ff5341b22a3 (diff) | |
lib: sbi_scratch: Optimize the alignment code for alloc size
Signed-off-by: Xiang W <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
| -rw-r--r-- | lib/sbi/sbi_scratch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sbi/sbi_scratch.c b/lib/sbi/sbi_scratch.c index 87b34c6d..55ebdbb7 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); |
