2022-01-13 10:06:44

by Farber, Eliav

[permalink] [raw]
Subject: [PATCH 2/4] EDAC: Remove unnecessary cast to char* in edac_align_ptr() function

Amend commit 7391c6dcab30 ("drivers/edac: mod edac_align_ptr function")
and change all return path to use void* instead of char* according
to the new signature.

Signed-off-by: Eliav Farber <[email protected]>
---
drivers/edac/edac_mc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 61d72bd96754..8b9b86a7720a 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -263,12 +263,12 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems)
else if (size > sizeof(char))
align = sizeof(short);
else
- return (char *)ptr;
+ return ptr;

r = (unsigned long)ptr % align;

if (r == 0)
- return (char *)ptr;
+ return ptr;

*p += align - r;

--
2.32.0



2022-01-26 22:30:05

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 2/4] EDAC: Remove unnecessary cast to char* in edac_align_ptr() function

On Thu, Jan 13, 2022 at 10:06:20AM +0000, Eliav Farber wrote:
> Amend commit 7391c6dcab30 ("drivers/edac: mod edac_align_ptr function")
> and change all return path to use void* instead of char* according
> to the new signature.
>
> Signed-off-by: Eliav Farber <[email protected]>
> ---
> drivers/edac/edac_mc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
> index 61d72bd96754..8b9b86a7720a 100644
> --- a/drivers/edac/edac_mc.c
> +++ b/drivers/edac/edac_mc.c
> @@ -263,12 +263,12 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems)
> else if (size > sizeof(char))
> align = sizeof(short);
> else
> - return (char *)ptr;
> + return ptr;
>
> r = (unsigned long)ptr % align;
>
> if (r == 0)
> - return (char *)ptr;
> + return ptr;
>
> *p += align - r;
>
> --

Applied, thanks.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette