From patchwork Tue Jun 27 08:53:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13294210 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 A4B4EEB64D9 for ; Tue, 27 Jun 2023 08:54:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbjF0IyA (ORCPT ); Tue, 27 Jun 2023 04:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229670AbjF0Ix6 (ORCPT ); Tue, 27 Jun 2023 04:53:58 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05E28A4 for ; Tue, 27 Jun 2023 01:53:57 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35R8Jbv2028000 for ; Tue, 27 Jun 2023 08:53:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Fx7IaBf8CR/fP1Wtxm/X6qMQSOmOwdOEDudKGXOs3NA=; b=znaZ2jnqYdprTeAaPTZKQTX5PW9k2/RYNeAf6GP56qXu0O0wbjWw1KmzmSeFjy3v1gxu qsMADyl2rhnWFjGW5kQVni/Z7K+hv2K+YZ8ysJiuIMlEO58cYgCsJKnIYb/IonkDKWQR l5Cyti6ogAU5Dma0rwiGoSotYcGT5h/71KU7TiQS/YRSyny03ahmKMBerpISFxAhMJmS ItcOoE1hFig03IPUsdwjjHhTdE0H8DtLg4tRMp2mdb7B9evC1ASFzWvLX2ETGG9dRyst DG+GeYcBL6y6Yux54QZZ7MjmSgqmeMPEt9YEamNHd+tdYJpD5+1KM2oIhxEFloNQc4FD Hg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rdrhcmj3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Jun 2023 08:53:57 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35R88sfo011169 for ; Tue, 27 Jun 2023 08:53:44 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2043.outbound.protection.outlook.com [104.47.57.43]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx46twq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Jun 2023 08:53:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ms4P3FkIGZaevBUlebdJWS9GEhVenJWRhEW8lfTEIhzmGpz9a9bilp5eb2nQh+UzanaZYBaZLehfV09zVDzTBkY2xWx8ef+VpYQQc8ctMbM0t9WtYwrMdJUWdUKfgX5ophys+ptwPaRk9urhSagMwZ7NtCXAkE7v+mt3xePVCfRXJvobVadsag5dvFeKAZI0J3SxnYmr4v+xP2soImxA89apAkFXUPufKWikfIUyTTRpE+LwGaoq+WkDFbsqmp0CyTfXji2vW5rNjLLuPAfTKDruVi8WCYsLK2rcyC6rYOgT4Fy4QchQt0NFNRP546zgzqdcxF4wjw44Xasq63m4vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Fx7IaBf8CR/fP1Wtxm/X6qMQSOmOwdOEDudKGXOs3NA=; b=gt+XFwJTg4kf7AKd7b7GOd5dN1mMDQs4hmArn+KDRiN2gUzCRDOgXI61pcWqMwIClX+vDN/m5lc7HWRsgT9Nf/H4uzb2HVNX13lhPx3cxV2kSV6iWBdtlxn0kL1eOBKmPIDktslizZ/Yo93rcDoOrMHX5EZ0jIPnRsqsdLSpc3541rmDMdR6UNGdgKtFPMjua6+bYHouv+ggvTU/6X59BNxkqYdEro5ezpZVtqof1pZU16s8QFw1NnrzJaCUfhieCGfNY1OKbveKiVduyUg1K1Pta6Em4qvQKo0hVHtDaq3ht7Xo0Pd7EvyUA1R5k9dk6CQv8bC2HjRiJ93LcIHUyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fx7IaBf8CR/fP1Wtxm/X6qMQSOmOwdOEDudKGXOs3NA=; b=F33QK5CK58xKeaTtHr2dt/1N0WiP3BsMSMwUIRm3rdT9l64j4l0/cNaJHebIRGEOeMIRkoDSLCTEepUptEHAooRgiaM9tynr/fE2Sa6SuQMfEvvx3nbTrapiBbaHQXBq7tB8W1P8Sm+bnoPeZM837M74Xij7+LOHG/HAYY1YqaA= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB6520.namprd10.prod.outlook.com (2603:10b6:806:2b2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Tue, 27 Jun 2023 08:53:42 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6521.026; Tue, 27 Jun 2023 08:53:42 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/3] btrfs-progs: dump_super: drop the label out and variable ret Date: Tue, 27 Jun 2023 16:53:14 +0800 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0024.apcprd01.prod.exchangelabs.com (2603:1096:4:192::20) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB6520:EE_ X-MS-Office365-Filtering-Correlation-Id: f28afeac-6a85-422d-bbbb-08db76ec0217 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aGW6lylSawf6nzIMiciO/yKUDm2QPwsuOlWulCm1jZZ/XAUM45N9SWd0L08vGy+IEv+V12osX3siHxqQ9G3yoNb6B9v2hsnTvZEDVPlDNXfALgYvJ6dMZD8/K5QadN7CbYJg13OOVZXyPOOplLtELTY5Q/S7rr++ysajMZlh8Msv0qr+HjDBF9ddirRpFPbBfLMl90Sj6lKhaaeahT83SjkCmkCeR8jmVKXZmnqgUgnzooG5j/M+bX/J3P1cVh8GUV8PIVC8PQ4MmEmIKUbJiFqXslfDA6250fUmZtscmKO14BjzgYdVACj5ZrLLJZ4ALUPnppONibnB4OXFcEOIX+mNXumlD60Xwy2P+ouJ1ZdSBdb8E8mzS4w/vAXolsRycmiMw5dDPqT/vDQpi2fwqakWGZv2UzVms2pGEGaXvZyMJsJzJb9JTL7lhXSKH6xAGGCPEmaCRR4Q7Ln6BhmywRXbl38vVoGqWo4QttkhuC4dZer3W1em2C3D0QWLu6zHq/chNcGQ5aYpxxjuSYg7srNfS7B1hUNyd4q5LyupceDeqF/KNjhR+bfs/6nE8s9+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(366004)(346002)(376002)(396003)(136003)(451199021)(6486002)(38100700002)(26005)(83380400001)(2616005)(6666004)(186003)(6506007)(6512007)(41300700001)(2906002)(86362001)(478600001)(316002)(66946007)(66476007)(6916009)(66556008)(44832011)(8936002)(36756003)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N9zGBFDEjqIP0yLz6AifF54pUTUaYwEsSxtIoVwnIqNwKcw3rJwx/Y55CkIz7yi6lZKCiP3B3CAlASiwKN31WagHqnZ34ScvQv55QqxeyVPGpc2QO3LsV2mE2apkFryEJpciEfJ8jMaw63DcgCzzuoOGzZN6vAVQPYuYN0bT/WEau+t8BDvQoq/nkc8UZ5Cq6lhNMw3qUEqdkEATlR2nN7z0EDJHjpF8jXCLRdw97XLyVRMbXGed8YRzolGNNeohjYHXYJfGgEDft6JlognCHXvmuVDN3OiJE8BZSkfNGz2bJP+t+OhS74QrzrXlDzIkZpwnbmkGx6MD7EenyFw/RTr5b3tS0MwOab7Vqsv+8BXisvc0OeL83XJjUxQtCK4h38Ro7HZxIysJnd60rcVJZbjIFXrZxHyUblkZybqvmLoYdYVUgb3hmYkUxcRzF64J4zOemjZ3tfp8xXrTOg9jByn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qj49OsfFPwLUxszhy3wgJ0V8K+vnDnGxaNeqd X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: JfbLFDN7UBMRgDRj90vLClz0YoEriJVIK8MLOFCBDsZiZ3lZB5Xo0NNUExHqSUo2jggMB3gjGNY3xGiWb+vpbnsTrJ/J1VuqfKEkXLG5aH1lsPkAvNJkySYnCLFCRqrL0uPm22oUwkqJ+8xKFDgwgYHxZQHo4Pbye4uBvcEku5fQRwIG8qwnEeDzgIWeiT6arMQmGtHsJtTDGjAHL3i+om9ry1W4m3pr7mZ/C3LojMeL6LNPQrIU964+tJCPS/oUZjF6jZ9XG1yKG3MrvhRL6Up0NV9824QhQ7jrt5U4Q4couU8sFUL3I9OscQaDcQRZE5/qQLul6ZvZK0IwCgbeteuS8rT6UtmAgFzAcvYZXdUIbPvGG+cy87HaUhXV8+yQRJYcJ+EWsD/Qffw6SV+fmtKvRxI/7S0XNeEoqPLRTdIeEQcdqApLSAbgdOSJ2u4K2ggrjKoz2vdJDfueVxHkXDfFgs9lRDFlAvkuCQgL/61dIEEhBZJEQuO0TeKl4GGXFmhXuVKjvf//isSBDJcj2n5O2oPw2RJ4S8ijUzLx8VdCpNiYa2dTJfaJx8T+VYsPe7YNTtMPBQ0gWlT09ZAjbd5XmZUwZ+TqP64/qyHgDn8Ei+vGmXIuTXUhrC2PpHeWvdahLTHEjjCKhuqoyzvu04q27PPWtQSft6xqNTkFUjOGRTOdHz/tuOMhpwG3OgN9I2h5iJrLJBPWWSNlOyaaIK1RDFQYj6zQL8tBA2afran55tYrI21/W0r2h+XCsKL3JgQQk1oYE3ehAYFdV/OW8w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f28afeac-6a85-422d-bbbb-08db76ec0217 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2023 08:53:42.5703 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ul7uKelJHu8MV19h9/+mrvtF28Ywb6u9sZgwUcL9gs6ZzRHgkcHY2i3C15VlPUbT+5jDB1JdwhbLLEqHfedjwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6520 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-27_05,2023-06-26_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306270084 X-Proofpoint-GUID: OeirntYT-bt2blc2DmjKKn8T186hfvDd X-Proofpoint-ORIG-GUID: OeirntYT-bt2blc2DmjKKn8T186hfvDd Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In cmd_inspect_dump_super(), at the label 'out', nothing much happens other than returning ret. At the goto statement to the label, in the for loop, we perform close(fd). However, moving the close(fd) to 'out' as well is not a good idea because close(fd) doesn't make sense outside the for loop. Instead, simply return 1 instead of ret=1 and then returning it. Drop both the 'out' label and ret. Signed-off-by: Anand Jain Reviewed-by: Qu Wenruo --- cmds/inspect-dump-super.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cmds/inspect-dump-super.c b/cmds/inspect-dump-super.c index 4529b2308d7e..f32c67fd5c4d 100644 --- a/cmds/inspect-dump-super.c +++ b/cmds/inspect-dump-super.c @@ -84,7 +84,6 @@ static int cmd_inspect_dump_super(const struct cmd_struct *cmd, char *filename; int fd = -1; int i; - int ret = 0; u64 arg; u64 sb_bytenr = btrfs_sb_offset(0); @@ -156,8 +155,7 @@ static int cmd_inspect_dump_super(const struct cmd_struct *cmd, fd = open(filename, O_RDONLY); if (fd < 0) { error("cannot open %s: %m", filename); - ret = 1; - goto out; + return 1; } if (all) { @@ -168,8 +166,7 @@ static int cmd_inspect_dump_super(const struct cmd_struct *cmd, if (load_and_dump_sb(filename, fd, sb_bytenr, full, force)) { close(fd); - ret = 1; - goto out; + return 1; } putchar('\n'); @@ -177,15 +174,13 @@ static int cmd_inspect_dump_super(const struct cmd_struct *cmd, } else { if (load_and_dump_sb(filename, fd, sb_bytenr, full, force)) { close(fd); - ret = 1; - goto out; + return 1; } putchar('\n'); } close(fd); } -out: - return ret; + return 0; } DEFINE_SIMPLE_COMMAND(inspect_dump_super, "dump-super");