From patchwork Thu Oct 12 22:09:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13419847 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F319ACDB482 for ; Thu, 12 Oct 2023 22:09:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.616064.957772 (Exim 4.92) (envelope-from ) id 1qr3s1-00017S-Vd; Thu, 12 Oct 2023 22:09:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 616064.957772; Thu, 12 Oct 2023 22:09:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qr3s1-00017L-So; Thu, 12 Oct 2023 22:09:29 +0000 Received: by outflank-mailman (input) for mailman id 616064; Thu, 12 Oct 2023 22:09:28 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qr3s0-00016v-B4 for xen-devel@lists.xenproject.org; Thu, 12 Oct 2023 22:09:28 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 00f71115-694c-11ee-98d4-6d05b1d4d9a1; Fri, 13 Oct 2023 00:09:26 +0200 (CEST) Received: from pps.filterd (m0174682.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39CKqml9008371; Thu, 12 Oct 2023 22:09:23 GMT Received: from eur01-db5-obe.outbound.protection.outlook.com (mail-db5eur01lp2050.outbound.protection.outlook.com [104.47.2.50]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3tpr7cr8dp-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 22:09:23 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DBAPR03MB6376.eurprd03.prod.outlook.com (2603:10a6:10:193::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Thu, 12 Oct 2023 22:09:17 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::f606:63f7:5875:6076]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::f606:63f7:5875:6076%4]) with mapi id 15.20.6863.043; Thu, 12 Oct 2023 22:09:17 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 00f71115-694c-11ee-98d4-6d05b1d4d9a1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h63PPNZt3JfrvOJ4ZdEAarqk8/nnxRj5O2mdCGhqm5fqHBavlVR/wmtDTUMLKcH/LHJtk1u3ok2LZXo3daIt8H83FULAEec96x/1X56riIRTBQdMazCjDT+lg2UFXyksgYFngsJkDJ77XzxUHRlOsBFv/RNfwuo4Ti53Z93g3QR0w+E7fNwY49GcQXzcb4RuHH4O36KohAZZG4KygfO7WdLLVELCVC4hTb5IzSw9D5tK4CchBCC2wLIUmxlGxP2PztHM8hlq93HV8i0Q2fHofuad2eQZ6B+lN0L+9N4+nUAbC8EpQn8cmQP7GgkWeUIbfbAjcVTmtoesco6yBjHNrA== 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=zMLvoJ8oLwDDcIwwFQCmO1G6TxLtjEG3z/3WmRJCPC8=; b=cj6d/YyEeNdAMACZm8lGafBreEklzgsBPYRNlhhdENjWWgpx4wj53dSSWYNk3efWF6sIiAjZPKZE8dDFbSULrzrHssSSm1oUydkEmRV2+eO4rvrO5QRRAwaZ1Uq8TlQPRm/itiYsZyUhj3r/f0MssnQz0dC9dBNiAR0fFYXnAZ5aPx5JsmdoQoBEtZt4C8r8xcbP7b9otzt9uU2kq95qmprcY3imipkKtJxyhkRmypEstuHD96NdijnTcIUS4EKvuwYIQ7Rmzc5zUbGaf3I6gOdbThuVSnngm1lw4iv7F8qgylAMC7NcsS5aoWez6jY2DRXHf4Gj4oUqiu54fLxdvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zMLvoJ8oLwDDcIwwFQCmO1G6TxLtjEG3z/3WmRJCPC8=; b=CtKDOFS4Qamh5MA6OTmYZ/iVQupGqJ4Ayfycsf0H1NlwIKLLDRqGi2OCvx4B9OtXlSTjWAJTGsTutnIBZN/cuK0jhXWw0qm0+0BnZV/aQxNKMr07Q9F9Nd8s3b13ahCpJz3pwE/Gdi7TAskzzrpAOsqFHV2nDc2SOjh8skExjsL9F1+rB970ZmkhtufvgrGItnnE88viMh5eJXAiX3o7jRrAgtfD2ALF8tUhRtubajMPazjc2RXWPgopdvBg4mYfadZjvsJHX2r6B6hwuo9zU/S1cg9geyRNHX5ECRXHcKLlv5ltSThchBW6/GwvQl7WX0U5gDCUl9Je2hVNw5+rPg== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Stewart Hildebrand , Volodymyr Babchuk , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= Subject: [PATCH v10 06/17] vpci/header: rework exit path in init_bars Thread-Topic: [PATCH v10 06/17] vpci/header: rework exit path in init_bars Thread-Index: AQHZ/Vi9WQzEUKFClEWKXSReXuWjGg== Date: Thu, 12 Oct 2023 22:09:16 +0000 Message-ID: <20231012220854.2736994-7-volodymyr_babchuk@epam.com> References: <20231012220854.2736994-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231012220854.2736994-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.42.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|DBAPR03MB6376:EE_ x-ms-office365-filtering-correlation-id: 7c11578c-7fcc-47a4-4889-08dbcb6fe075 x-ld-processed: b41b72d0-4e9f-4c26-8a69-f949f367c91d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M/D5Wx0CEZKab6dvl8nUSy9VRijS0vZ3VQwpXXpaXVwKMLRfwfzhrjzdyjTtzq3VqNjR1S0fxJWfzzG9Gt6G6d06Vqes/QR9IMjJxPt1oBvpqrViEJojt1lpEcVKFr/tm1d4MwR7kt2+NyH01Et3U9vN2BmmwLif7fo/LNXkGbexK57r1W66Xx84ftGlruFWWPBe+5MfkcK9DKqXLpFhyRQiHvtjnLMY+Ha2M2K5lJTsBA3ugvHD2ja6pjL5vKdViDEmhdUxZaA8zpArHMPNEviFK67q1eJ24p8Si67ztsqzKRPGCCH6SigfdnoNw5b73yDQcQiieskBrvc22XadTRgy+Dm09HSgJnX/fMin3GoQVRb/TKa5WqZrtf1UtPnyF8O177WeLcqdVqcPqrePvLqPuWaHpfkxMoE9TyllPr97Z+l/2EYZXNgHjNZyCJalHupAjSZF9hOHJMZr8jWRAeRxvulnx9L4bx0/tVfcnqnXZDutd6tWLT3CMIaSkMwK8n/86P4BSDBre+56jKA1gsPBoTYx5z9AnS78yhF4/hMLT7U/TvWqHWHy9u0UWDA903HKhSKy46/vOPKcidd67GLPuZo3XsxBHHh8ML1rlBoVmrpZumhRIFEzeLRR0R95 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3710.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(39860400002)(396003)(346002)(366004)(136003)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(2616005)(71200400001)(26005)(6512007)(6506007)(55236004)(36756003)(86362001)(38100700002)(38070700005)(122000001)(1076003)(83380400001)(91956017)(41300700001)(64756008)(316002)(76116006)(54906003)(66946007)(66446008)(6916009)(66556008)(66476007)(2906002)(8936002)(5660300002)(8676002)(4326008)(6486002)(478600001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?czngQSDCvLQOvJPF2tuDWfoOQo0s?= =?utf-8?q?/6moLGWoLPAkuMxKWLHAK2Njokmzxynv86B6jbAKAVfTJ4yBriaHig4EEQ3E7br6Y?= =?utf-8?q?VvXFZM5Z71ZHx9x/B9bZENTNGeBtY9bQD7waL+KcSpJJuMuYCI4+QDn5ZjVJGG515?= =?utf-8?q?jVooS6Oz/kDo0Orn3XsulcjrlGCpg9LNuR1nchi9t6K6I88rmXygVd0OZZ5d5mv1N?= =?utf-8?q?DLNamu1H6Ufc4lX0A+iQdhncSwgKmXgv9YX/DbTuWncNLcAnPjkzVoTVGtSNiZbPu?= =?utf-8?q?EQh0LaQuwTLP4GPbI1D2SdoyI7LbyAq39KX1ttiG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MR4H4AqEdHFAR?= =?utf-8?q?8uw5cAz4pBEyMekPopd2o1w3U8iJkBIV1Eig8wXj6ed2wgWHciiYipao8WOoCmSYA?= =?utf-8?q?Mv5mPixVkRtgD4oML6O2PNE76uh6WkZxvJqzmTUpjRRHPdEOpZbM9P2wCtGiTI7y3?= =?utf-8?q?61rq2X7sAtAyFmxNG2OSB7BhdD0XcFv6DGdq3N8GR++G6hiNDsX/cZxOGhAufdSGV?= =?utf-8?q?d/+i74kXXbxRF3ZldEGV6Vo3KOkKgAXNamIgLB+VCC4TqO4pNDVk6erHUHcgyUifY?= =?utf-8?q?NPi3/VB6EBQZIa2xYZ2+AbSX8QWWwkOiICRNZgTAwcuolpHwksfmga8S36d6mu/5S?= =?utf-8?q?3aDpDkXhcHmRaAI4wJFN5KmmqfnmwVqOeg=3D=3D?= Content-ID: <0C02E46285954F4D8569410BCEA0378F@eurprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c11578c-7fcc-47a4-4889-08dbcb6fe075 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2023 22:09:16.3254 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1pIvwGhVxGNY7O5U3lPKRBNrTuZ2o0XunhKF1Y2fdlCAPsOoapOtgSwEyRGVFtNkDJvUSjwu+rk4mH1LvBLTKK2jAqjSaUM0miXV9Fi9Ezg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6376 X-Proofpoint-GUID: s1xqamOyCo_cF0K__10qdjW3KjxVfRg- X-Proofpoint-ORIG-GUID: s1xqamOyCo_cF0K__10qdjW3KjxVfRg- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-12_14,2023-10-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 malwarescore=0 bulkscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310120186 Introduce "fail" label in init_bars() function to have the centralized error return path. This is the pre-requirement for the future changes in this function. This patch does not introduce functional changes. Signed-off-by: Volodymyr Babchuk Suggested-by: Roger Pau Monné Acked-by: Roger Pau Monné --- In v10: - Added Roger's A-b tag. In v9: - New in v9 --- xen/drivers/vpci/header.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index 176fe16b9f..33db58580c 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -581,11 +581,7 @@ static int cf_check init_bars(struct pci_dev *pdev) rc = vpci_add_register(pdev->vpci, vpci_hw_read32, bar_write, reg, 4, &bars[i]); if ( rc ) - { - pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd); - return rc; - } - + goto fail; continue; } @@ -604,10 +600,7 @@ static int cf_check init_bars(struct pci_dev *pdev) rc = pci_size_mem_bar(pdev->sbdf, reg, &addr, &size, (i == num_bars - 1) ? PCI_BAR_LAST : 0); if ( rc < 0 ) - { - pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd); - return rc; - } + goto fail; if ( size == 0 ) { @@ -622,10 +615,7 @@ static int cf_check init_bars(struct pci_dev *pdev) rc = vpci_add_register(pdev->vpci, vpci_hw_read32, bar_write, reg, 4, &bars[i]); if ( rc ) - { - pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd); - return rc; - } + goto fail; } /* Check expansion ROM. */ @@ -647,6 +637,10 @@ static int cf_check init_bars(struct pci_dev *pdev) } return (cmd & PCI_COMMAND_MEMORY) ? modify_bars(pdev, cmd, false) : 0; + + fail: + pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd); + return rc; } REGISTER_VPCI_INIT(init_bars, VPCI_PRIORITY_MIDDLE);