Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1739714rwl; Wed, 12 Apr 2023 18:17:59 -0700 (PDT) X-Google-Smtp-Source: AKy350aRfvKoLDvijV+jT3+nIgcNynDZZpLw5lts/84VBjSKX/WDCV7KUm3VfsMxnKIqrtxE+qIt X-Received: by 2002:a17:903:454:b0:1a6:8145:8f33 with SMTP id iw20-20020a170903045400b001a681458f33mr329126plb.10.1681348679702; Wed, 12 Apr 2023 18:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681348679; cv=none; d=google.com; s=arc-20160816; b=xAuSus4KWY+9F6ICU7JLadOr2m6vsFnByjvpOQ3obdoLdBN6MdXpk+wHZdQMMzeikk cxFM8c3OzEkUtW+OXLncqyVF+bi3rgifnc22ef3vG2w+HDSYKbeEywDrcVbG1rEysQEm SacLlr/EVT0Go1MYiNpfVcvpf90bnAFdPeizXIxf9qtgBBLWna6EWnjBPRjaItUoYVQ+ pOhrrLfLlHdlPgaWdzE2jMztRbnmGH9m0ieJvQsnn8FeCy31VJUKb5O4hVLkX/S4rYqV gV7PKBz+fOQraH/dn75dteN4C0xJ9pokNVLRmV7FBbf8zhX2pR/ivanrW0/+erQBoPuq 4ITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:abuse-reports-to:tuid:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=ynGv7+0zq0CnTNBKQrUbpcMiUUpm4bExrA/sUgYYsg0=; b=OFj1/0DvWh6aKoD/3OUw7396QgRwRwg7ZiGwRYRkEhIkFkwYkSnqbjoqjeqFPTHoI9 Cci0CCii447S9czNGdvVeRIosqpBNJLLOBnmPHNPU1f6s6/guz6MtYI3px9ZBzhe7UsJ gck36B0GEov0cGFvcoQdcMVkIZNf1H6O6fGxVB0AOsuwKwsD1b285bYE/CJR7WF4mGlb jr0lPN7bL0etAT01hzkatuiDnzyuoD6K96cLvv2nW4q3LID4618SGSev7e8AUDfJR5IJ Hn+yWjMCUGbSWUzPSdSI6wnJ395ZkWSfeTkWWpODa9qGu66f/a0zgL9eHdlGbeRHP/pG e3mQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a170902900100b001a0a44fa597si588666plp.109.2023.04.12.18.17.47; Wed, 12 Apr 2023 18:17:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbjDMBDE (ORCPT + 99 others); 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); } -- 2.27.0