From: Deming Wang <wangdeming@inspur.com> To: <mpe@ellerman.id.au>, <shuah@kernel.org> Cc: <npiggin@gmail.com>, <christophe.leroy@csgroup.eu>, <linuxppc-dev@lists.ozlabs.org>, <linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Deming Wang <wangdeming@inspur.com> Subject: [PATCH] selftests/powerpc: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 21:02:50 -0400 [thread overview] Message-ID: <20230413010250.4254-1-wangdeming@inspur.com> (raw) memalign() is obsolete according to its manpage. Replace memalign() with posix_memalign() and remove malloc.h include that was there for memalign(). As a pointer is passed into posix_memalign(), initialize *s to NULL to silence a warning about the function's return value being used as uninitialized (which is not valid anyway because the error is properly checked before s is returned). Signed-off-by: Deming Wang <wangdeming@inspur.com> --- tools/testing/selftests/powerpc/stringloops/strlen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/powerpc/stringloops/strlen.c b/tools/testing/selftests/powerpc/stringloops/strlen.c index 9055ebc484d0..f9c1f9cc2d32 100644 --- a/tools/testing/selftests/powerpc/stringloops/strlen.c +++ b/tools/testing/selftests/powerpc/stringloops/strlen.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0 -#include <malloc.h> #include <stdlib.h> #include <string.h> #include <time.h> @@ -51,10 +50,11 @@ static void bench_test(char *s) static int testcase(void) { char *s; + int ret; unsigned long i; - s = memalign(128, SIZE); - if (!s) { + ret = posix_memalign((void **)&s, 128, SIZE); + if (ret < 0) { perror("memalign"); exit(1); } -- 2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: Deming Wang <wangdeming@inspur.com> To: <mpe@ellerman.id.au>, <shuah@kernel.org> Cc: Deming Wang <wangdeming@inspur.com>, linux-kernel@vger.kernel.org, npiggin@gmail.com, linux-kselftest@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] selftests/powerpc: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 21:02:50 -0400 [thread overview] Message-ID: <20230413010250.4254-1-wangdeming@inspur.com> (raw) memalign() is obsolete according to its manpage. Replace memalign() with posix_memalign() and remove malloc.h include that was there for memalign(). As a pointer is passed into posix_memalign(), initialize *s to NULL to silence a warning about the function's return value being used as uninitialized (which is not valid anyway because the error is properly checked before s is returned). Signed-off-by: Deming Wang <wangdeming@inspur.com> --- tools/testing/selftests/powerpc/stringloops/strlen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/powerpc/stringloops/strlen.c b/tools/testing/selftests/powerpc/stringloops/strlen.c index 9055ebc484d0..f9c1f9cc2d32 100644 --- a/tools/testing/selftests/powerpc/stringloops/strlen.c +++ b/tools/testing/selftests/powerpc/stringloops/strlen.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0 -#include <malloc.h> #include <stdlib.h> #include <string.h> #include <time.h> @@ -51,10 +50,11 @@ static void bench_test(char *s) static int testcase(void) { char *s; + int ret; unsigned long i; - s = memalign(128, SIZE); - if (!s) { + ret = posix_memalign((void **)&s, 128, SIZE); + if (ret < 0) { perror("memalign"); exit(1); } -- 2.27.0
next reply other threads:[~2023-04-13 1:03 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-13 1:02 Deming Wang [this message] 2023-04-13 1:02 ` [PATCH] selftests/powerpc: Replace obsolete memalign() with posix_memalign() Deming Wang 2023-04-28 8:09 ` Muhammad Usama Anjum 2023-04-28 8:09 ` Muhammad Usama Anjum -- strict thread matches above, loose matches on Subject: below -- 2023-04-12 11:12 Deming Wang 2023-04-12 11:12 ` Deming Wang 2023-04-12 12:02 ` Michael Ellerman 2023-04-12 12:02 ` Michael Ellerman
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230413010250.4254-1-wangdeming@inspur.com \ --to=wangdeming@inspur.com \ --cc=christophe.leroy@csgroup.eu \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=mpe@ellerman.id.au \ --cc=npiggin@gmail.com \ --cc=shuah@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.