From patchwork Fri Sep 29 06:14:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 146430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3814463vqu; Thu, 28 Sep 2023 23:18:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMCNrCW9o+8TW2b0IpvpsOI5UbGl5XMX5ItUGyyrk5oMJPrdi8DTjRBuo0dfkbTUjzMtmT X-Received: by 2002:a05:6a20:7fa6:b0:14c:daa9:5e22 with SMTP id d38-20020a056a207fa600b0014cdaa95e22mr4147506pzj.45.1695968306192; Thu, 28 Sep 2023 23:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695968306; cv=none; d=google.com; s=arc-20160816; b=JgKlNLsM75KWTwMYnd++MKUNRBHuxV0k9xhUg8OwF+hV7G9lSwvNGkbJ9mBGj8YuJh ilaX4QuMqZD6BA4M4oB2uMGsud3KV2WV23ewISKw1Omk+Lhe/6wpD4iUt7+oUwejFv5a 0MteDo1EklS1mhyWoYNNvpiWvBIF8mJPZJmYa2XISft5TnqTd7kcRg0wSi9klLqgZACt wQdjLL/QQq0KVWZ1FePg6KRcSvxx2hu1sTxSTdSYwXvkqxU0pkDU+Fy5iSnNUvoJ8qqr 4QBh3+SMyl54W8plw/LGwBeH/UQv3Ce9kEdOz87l/n1ZuOa6yHDsdgUOitNKcWaeS4gL BOyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=RVdBB2Mwa1sVpB7MI2QiAh7qYS+KzeGjeSgJJ4XtExM=; fh=YygLGKUlh4nHQ5Rdr9ftF/ryVinr9z2zBS9B5G9J/50=; b=UIydL4wWAI3xvj//9avJxg69qCFVB6wF5MLt+cw/No3bQjshDXw0KdG6ZsyRmkgrdG WEW2Qc9caAYfUABey5Zv4hYl76MBQWm+aUzqvCAuYWPkRzpnNzXkCaQP7QjS75iwT9o6 XTa/MHUxuB2OkOTLokxpdri2rxFdiSrQ+VlzJiHqjGBqGTaNDRKr0MJ06s3L0DLzUyZy XqTHpKd7LfnJkFdKmci5vPuqUyqNFCg5WQ0xCyOrOyjIx28x9Eer4LDQ56VAw0zYnP61 QcCfHdkIVRMhZiBNtHjefm8CsgnNjU953qjestl61PVSRsOZzgvNxiVxzGUnpKUp4kk3 qrxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=BT5FFlQp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id cr9-20020a056a000f0900b00693378349ecsi6403585pfb.351.2023.09.28.23.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 23:18:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=BT5FFlQp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 68524804744F; Thu, 28 Sep 2023 23:15:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232666AbjI2GPF (ORCPT + 20 others); Fri, 29 Sep 2023 02:15:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbjI2GPE (ORCPT ); Fri, 29 Sep 2023 02:15:04 -0400 Received: from mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0700098 for ; Thu, 28 Sep 2023 23:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1695968086; bh=sUtnhl+BN0pAXgvT1VA9dfcxtXJrnbj9wF0wciOqpdA=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=BT5FFlQpPpYYiLWCg0obrQwHB6L2jyl1IDQj4NY5PfCuvzM71FERDYaVd2NdJ48Pq Cchkcw4ji4i6zgQbnC7a3yMpUUgBsHN/bIIiBwonfYk/btOo0uizwSWjwhn7wzkPOl G7fnpFFwQLvucAEwRU5T1RZn/pRHsU9gHvLyAhiw= Received: by b221-3.in.mailobj.net [192.168.90.23] with ESMTP via ip-20.mailobj.net [213.182.54.20] Fri, 29 Sep 2023 08:14:46 +0200 (CEST) X-EA-Auth: mJrxcB5o/rp3CdNHoV+lGMylfQKBbaAvaC4JHT2Uwm3geFEykZ96si8l7FTXLh3ZxpTAt34dRlCrz8K4QFKtJ4AC9NHhu1Tb Date: Fri, 29 Sep 2023 11:44:40 +0530 From: Deepak R Varma To: Bob Peterson , Andreas Gruenbacher , gfs2@lists.linux.dev, linux-kernel@vger.kernel.org Cc: linux-kernel-mentees@lists.linuxfoundation.org, Dan Carpenter , Deepak R Varma Subject: [PATCH] gfs2: Set error on error path Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 28 Sep 2023 23:15:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778351662407705152 X-GMAIL-MSGID: 1778351662407705152 Set the error variable inside the error path on failure. Saves unnecessary variable assignment during normal execution. Signed-off-by: Deepak R Varma --- fs/gfs2/bmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index ef7017fb6951..93bd8ea34444 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -162,9 +162,10 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip) down_write(&ip->i_rw_mutex); page = grab_cache_page(inode->i_mapping, 0); - error = -ENOMEM; - if (!page) + if (!page) { + error = -ENOMEM; goto out; + } error = __gfs2_unstuff_inode(ip, page); unlock_page(page); put_page(page);