* [PATCH] parisc: remove obsolete manual allocation aligning
@ 2022-09-14 14:23 Rolf Eike Beer
2022-09-15 5:34 ` Helge Deller
0 siblings, 1 reply; 2+ messages in thread
From: Rolf Eike Beer @ 2022-09-14 14:23 UTC (permalink / raw)
To: linux-parisc; +Cc: linux-kernel
kmalloc() returns memory with __assume_kmalloc_alignment, which is
__alignof__(unsigned long long) for parisc.
Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
---
drivers/parisc/iosapic.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
I must confirm it's entirely untested.
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
index 3a8c98615634..bdef7a8d6ab8 100644
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -221,16 +221,7 @@ static size_t irt_num_entry;
static struct irt_entry *iosapic_alloc_irt(int num_entries)
{
- unsigned long a;
-
- /* The IRT needs to be 8-byte aligned for the PDC call.
- * Normally kmalloc would guarantee larger alignment, but
- * if CONFIG_DEBUG_SLAB is enabled, then we can get only
- * 4-byte alignment on 32-bit kernels
- */
- a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL);
- a = (a + 7UL) & ~7UL;
- return (struct irt_entry *)a;
+ return kcalloc(num_entries, sizeof(struct irt_entry), GFP_KERNEL);
}
/**
--
2.35.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] parisc: remove obsolete manual allocation aligning
2022-09-14 14:23 [PATCH] parisc: remove obsolete manual allocation aligning Rolf Eike Beer
@ 2022-09-15 5:34 ` Helge Deller
0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2022-09-15 5:34 UTC (permalink / raw)
To: Rolf Eike Beer, linux-parisc; +Cc: linux-kernel
On 9/14/22 16:23, Rolf Eike Beer wrote:
> kmalloc() returns memory with __assume_kmalloc_alignment, which is
> __alignof__(unsigned long long) for parisc.
>
> Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
applied.
Thanks!
Helge
> ---
> drivers/parisc/iosapic.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> I must confirm it's entirely untested.
>
> diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
> index 3a8c98615634..bdef7a8d6ab8 100644
> --- a/drivers/parisc/iosapic.c
> +++ b/drivers/parisc/iosapic.c
> @@ -221,16 +221,7 @@ static size_t irt_num_entry;
>
> static struct irt_entry *iosapic_alloc_irt(int num_entries)
> {
> - unsigned long a;
> -
> - /* The IRT needs to be 8-byte aligned for the PDC call.
> - * Normally kmalloc would guarantee larger alignment, but
> - * if CONFIG_DEBUG_SLAB is enabled, then we can get only
> - * 4-byte alignment on 32-bit kernels
> - */
> - a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL);
> - a = (a + 7UL) & ~7UL;
> - return (struct irt_entry *)a;
> + return kcalloc(num_entries, sizeof(struct irt_entry), GFP_KERNEL);
> }
>
> /**
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-15 5:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 14:23 [PATCH] parisc: remove obsolete manual allocation aligning Rolf Eike Beer
2022-09-15 5:34 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).