From patchwork Thu Apr 13 01:02:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deming Wang X-Patchwork-Id: 673029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A1DEC77B6C for ; Thu, 13 Apr 2023 01:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229508AbjDMBDE (ORCPT ); Wed, 12 Apr 2023 21:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjDMBDD (ORCPT ); Wed, 12 Apr 2023 21:03:03 -0400 Received: from unicom146.biz-email.net (unicom146.biz-email.net [210.51.26.146]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FCE2213A; Wed, 12 Apr 2023 18:02:58 -0700 (PDT) Received: from unicom146.biz-email.net by unicom146.biz-email.net ((D)) with ASMTP (SSL) id IVP00149; Thu, 13 Apr 2023 09:02:49 +0800 Received: from localhost.localdomain.com (10.200.104.82) by jtjnmail201603.home.langchao.com (10.100.2.3) with Microsoft SMTP Server id 15.1.2507.21; Thu, 13 Apr 2023 09:02:52 +0800 From: Deming Wang To: , CC: , , , , , Deming Wang Subject: [PATCH] selftests/powerpc: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 21:02:50 -0400 Message-ID: <20230413010250.4254-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.200.104.82] tUid: 20234130902494f5cc0be4c7a12b8b3835e93dee5f208 X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 --- 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 #include #include #include @@ -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); }