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: 82724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp711423vqo; Wed, 12 Apr 2023 18:16:50 -0700 (PDT) X-Google-Smtp-Source: AKy350aiKCmVkHlppTxWzaq3Y53Omx4EA4HG8WsC68aOhv3CNjlW1mJsbRshpDocKZGz083STHBw X-Received: by 2002:a17:902:e887:b0:1a6:7ed0:147e with SMTP id w7-20020a170902e88700b001a67ed0147emr403179plg.33.1681348610531; Wed, 12 Apr 2023 18:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681348610; cv=none; d=google.com; s=arc-20160816; b=CdfbonrXkjW2MuyL8CNbJkXeCU2/pQc11RybwVMIyiwDFgc/FKSOd7St0Ak3YU9jeU B2PABB7Av+yz2rzJwKMYO/GqcQFZWjyIgb/qAdb0t56jPmhFtqnPLoEW1L3VHM4TNw0H R6JsQqHKLbzskgLhgtYD8rpz/wwEnoxVV/Hsm44Uo6yyYtDuKWFN60cHBuZE6RxAB9mL wwZ8zhqkSZKHEuXUr/bGn2w/87GwRhm9fSTgF4A5KuPhILi+jupMtPU1uUG0OCtpIhZo WRvg8TfpogvAw8LtcTkRfh4YppcmHVWpI6xkFj7gD5kcRHkhNc+syCOpulWsDWwiY+iT EL0w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw18-20020a170903045200b001a63b045c86si598258plb.10.2023.04.12.18.16.38; Wed, 12 Apr 2023 18:16:50 -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 S229617AbjDMBDE (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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763021800146545033?= X-GMAIL-MSGID: =?utf-8?q?1763021800146545033?= 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); }