From patchwork Fri Mar 17 18:25:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li zeming X-Patchwork-Id: 70543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp237539wrt; Wed, 15 Mar 2023 19:09:32 -0700 (PDT) X-Google-Smtp-Source: AK7set/yfeByDBhmqB9Gb7W46uJ/8pgl52B+PID1Q5E2A6rdXVHg6ASKyOQIMRShq9SCpE1eYral X-Received: by 2002:a17:902:fb85:b0:19c:da68:337a with SMTP id lg5-20020a170902fb8500b0019cda68337amr1543700plb.31.1678932572433; Wed, 15 Mar 2023 19:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678932572; cv=none; d=google.com; s=arc-20160816; b=D+1XaVIWgF3a8lGewzDQ9NU7XJp5NqgX9S0/F8NrHkk5wjCa28o82J4+g6o/4pITnu cIVH8qRfB8jnr85wf9nYsTwYMv58nBcovX+eXvlut2cXooOrpm4oIHVKf+LPNLkCBiRt mqlk10tp77d5B8WLXNL0rdFTpTNSwx+4NX4e5EMnPsFfXJaurRg1zXqW4qZDJGY+uLCo hheX6tJJUkoP279ANyzrS3d0Suhhv/5zo64RjVJ+c6MuyhYsWno4NDNDS/N1Qb4xny2f nRaEb33TzK2qFW1LGEXDKdaxJi57kVCaT5FpKaAnrTRXQPS3ISuOZKoS3Me2fXNcXlMl hq/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=K+e8ZwCRhp3Pauc63kCMgI2icleCL+CzkE8CuqTzQqM=; b=fItZf0un8JsWtLpLRRX0UDi8a0xeZKpPlcyiEbEMZZpy/Ivrw56d8Lw05I1S4HRHns ORNDgBpruCE6+ELtIln9V5CyeYbeDZ7bZV51ZgGqOKFH8hPBkBcnv4sszytJlywXIsiw MSdQxzk6CYtBbGFxuE7QKC9SZ5zQrvF+KsJrqMkwkGPMQnvZ5oaqrxZiMLXcNrUQCOdg rEIVAluJriO6JpeazHuBTy6U0IyAuCkD4y/pJ1Kiu/MLnqLqGkp0mmT9SqH42a3Z4tQF AqD4Kr5fdnU0D7gRxbXCshkaf+Le8AVhdqh4/UDiJJe2ASzxrRfSy2ni5+V9/piS8pk7 5m7A== 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 lm5-20020a170903298500b0019f24b0388csi6902562plb.486.2023.03.15.19.09.13; Wed, 15 Mar 2023 19:09:32 -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 S229648AbjCPByX (ORCPT + 99 others); Wed, 15 Mar 2023 21:54:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjCPByW (ORCPT ); Wed, 15 Mar 2023 21:54:22 -0400 Received: from mail.nfschina.com (unknown [42.101.60.237]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 570F6901A; Wed, 15 Mar 2023 18:54:20 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id C62901A00AC9; Thu, 16 Mar 2023 09:54:19 +0800 (CST) X-Virus-Scanned: amavisd-new at nfschina.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (localhost.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jy_PM_FF9VBF; Thu, 16 Mar 2023 09:54:19 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id D666F1A00874; Thu, 16 Mar 2023 09:54:18 +0800 (CST) From: Li zeming To: axboe@kernel.dk, asml.silence@gmail.com Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, Li zeming Subject: [v2 PATCH] io_uring: rsrc: Optimize return value variable 'ret' Date: Sat, 18 Mar 2023 02:25:38 +0800 Message-Id: <20230317182538.3027-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_24_48, RCVD_IN_VALIDITY_RPBL,RDNS_NONE,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** 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?1760488401152345002?= X-GMAIL-MSGID: =?utf-8?q?1760488401152345002?= The initialization assignment of the variable ret is changed to 0, only in 'goto fail;' Use the ret variable as the function return value. Signed-off-by: Li zeming --- v2: Modify the initialization value of ret variable. io_uring/rsrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 056f40946ff6..09a16d709cb5 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -410,7 +410,7 @@ __cold static int io_rsrc_data_alloc(struct io_ring_ctx *ctx, unsigned nr, struct io_rsrc_data **pdata) { struct io_rsrc_data *data; - int ret = -ENOMEM; + int ret = 0; unsigned i; data = kzalloc(sizeof(*data), GFP_KERNEL);