From patchwork Tue Aug 29 23:19:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13369787 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 94152C83F12 for ; Tue, 29 Aug 2023 23:20:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.592509.925240 (Exim 4.92) (envelope-from ) id 1qb804-0006nl-DO; Tue, 29 Aug 2023 23:19:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 592509.925240; Tue, 29 Aug 2023 23:19:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qb804-0006nB-7v; Tue, 29 Aug 2023 23:19:56 +0000 Received: by outflank-mailman (input) for mailman id 592509; Tue, 29 Aug 2023 23:19:55 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qb803-0006kQ-EA for xen-devel@lists.xenproject.org; Tue, 29 Aug 2023 23:19:55 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8e3a94bf-46c2-11ee-9b0d-b553b5be7939; Wed, 30 Aug 2023 01:19:52 +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 37TFMk9i021983; Tue, 29 Aug 2023 23:19:50 GMT Received: from eur05-db8-obe.outbound.protection.outlook.com (mail-db8eur05lp2108.outbound.protection.outlook.com [104.47.17.108]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3ssdvpbm4f-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Aug 2023 23:19:50 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AM7PR03MB6371.eurprd03.prod.outlook.com (2603:10a6:20b:1b8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35; Tue, 29 Aug 2023 23:19:44 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::9d42:8444:f00d:7895]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::9d42:8444:f00d:7895%4]) with mapi id 15.20.6699.034; Tue, 29 Aug 2023 23:19:44 +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: 8e3a94bf-46c2-11ee-9b0d-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B4d+f4pv70rXV2sw928uvv07hADPv1MUOhzWAB1MNwYbqKoyCLC3iIn+IQ3gFjEV8S8aSMV2UjgD0M5pgUq07Wkom8VK3iNM+p4gkiKGvLqI7CaM8CQ87O2+V1y7P5HSczFLNUTxKj3UxuKBCbJIz9B/Be+YETf/2v1djj988jn0IRyr8/eT1GohhFuDHQtHGkpgO8RyD1yWl+SXRnKuabWoeu/86xvWxL2c5eYat17+7Y8A6Iha5au+GEYa5heljSXgAjU3gt9sR/zovieOMeiv25eBWECF41Lf9QCxSYTxuulfXc2KCTHZQ7duInlbyDSweXR2PLKiBxQFlfpfRw== 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=N2ERcj6JUMizs9Szx0x2ffT7vSpYcqMvosqrwubMiSw=; b=I3CG+YRWH+GFCXOjVWR5Vg72nYWBzGZMC8NaNMBzwB6RHcFaRmK3gyhpezHNnZ2C8uN4+o1Dat51/SOZnO4I1ymKnhECg2x8CNmM/aY9Ogjhh1XHB3RFO5T4zduAPatn2Rt+rrritzw0I+qm/SlqzrfHif4/BcBmWu//gmKgcPf2//IPxu5y1y7Pbc0elHynSJS4hPV62ELtmamzG4Da+1xq8PzdYRD3hbcim6lR0GpWs251H02EVvwRIe6qo1zyk5cIi7MGe0bRgIjqXkwhq1iZa5BbS1aaV7bSsUcpxjY9bwRtiw8gyAFf0TQRk91dydmQQt3+rYBSpTjZYW971w== 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=N2ERcj6JUMizs9Szx0x2ffT7vSpYcqMvosqrwubMiSw=; b=GnDZx+c94Y9G2T4CTrSVpsuEGF1HqqXFMbBF/J3NSvSdZmAAKR7WrHIlb7zAWyccCFaMtGSMbmaAjI81I+bH0FHstNaftvLt+C3MhlhKI0OHDX+jJPoOnp3nd4PQgV0Cbs7Uk0buOgMgIvD+VeM4xhZyDfshhzyD9VtuiTj9VGfGndWVeUWamc9WlPUcl0jyObgkxR/khD7MM0rv6BzDfSHwqmVdGvdkvFN+6QRIbw1ggfzZPPdg64oOdFT90/WwrTJ8KpIXU3egldsWMcDvFj2mOZCR6cBFN00ae3dq9cfzRGzzFQHC/Wd3hcsvEFmJSfCAz7ShS72RZkDmruLZXg== 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 v9 05/16] vpci/header: rework exit path in init_bars Thread-Topic: [PATCH v9 05/16] vpci/header: rework exit path in init_bars Thread-Index: AQHZ2s9KQBAEWRsQM0+8e3gDHK2mZA== Date: Tue, 29 Aug 2023 23:19:43 +0000 Message-ID: <20230829231912.4091958-6-volodymyr_babchuk@epam.com> References: <20230829231912.4091958-1-volodymyr_babchuk@epam.com> In-Reply-To: <20230829231912.4091958-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.41.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AM7PR03MB6371:EE_ x-ms-office365-filtering-correlation-id: 342a1b83-df3f-48ba-e858-08dba8e66df6 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: Fdb6/HI8nrT3tUV5/f0SskdHhznmf7e6jDU+2B89BajbLy2lE+lOaSBOmdJnJh6RUrp5qorP+o1adyUOPrPuST1wpAW9TzoU2Rp43pMJ9tzy/54X1GcVirDYbCVT3Vx3XZDboB7IJeqr1597tR8icC/sZTOlyaZSHWozuC3VTe+0H5ZdC+gkChBcRfCxC3WuLMgxN+nWM76yuYk5EBHXNdbHTKbT7rDTzxgJHb2TJlrVqQ0xCuhxjw6egfq0PCI44wPn0LCCeNofl4Nk2kOZcfh6st4NfiO8HI620EiVpUYtGYVg6CLFLnN1T3EHUSverJzhegRqErrFBZ7FaCgG6M+Ua1KhNWBY0BcNJHQDuMPrmm1Enb8+81rsWob4EO3wh8ZY8KSGfP2kuwgbE5LoJFvv7ArxPAECie4nOV/S01j7e837avsrFDguw8/xMu//MFSwCLQnHZbf6A+Z4w51GFWqHNTuKWA7OnnUUnKVqzmuJxbftWbjjCaXYekucCRD7gWbLe1jI2mE/h9V+jhPUXRHxyXVJB9YPUilAmtVAJBcKjrK6f1YbRzPJRb7ABU+0J5lXSwUYMzEkmYQUA9hxxD6it0GBUzFnx+7CQpaEDn2F2jueqcB7pCOshJozPtk 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)(346002)(39860400002)(376002)(396003)(136003)(366004)(451199024)(1800799009)(186009)(71200400001)(6512007)(6506007)(6486002)(478600001)(55236004)(76116006)(1076003)(2616005)(26005)(2906002)(6916009)(64756008)(66446008)(54906003)(316002)(5660300002)(66476007)(66556008)(91956017)(66946007)(41300700001)(83380400001)(8936002)(4326008)(8676002)(36756003)(38070700005)(38100700002)(86362001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?fgP9NKyRSA9l8IBLLsgpnfFJaT5/?= =?utf-8?q?usttCQMlPXRKU33KLqvvQyIHuzfDGuYJj3R/UuF9vbtHHuS3oPnd8XzeLZsqdoWCs?= =?utf-8?q?35uF6d7Y7ThV1TD1za70ihSm6EQPwWbfyjRZxa51fpADuVi6tI9eoSsXgMedGURZS?= =?utf-8?q?AmvXCTuJ49Zd4i8es3su3ZTdNZ9DanyxmmeKfEs+fWmhJP2PXJ3lDFO878qoEwnKi?= =?utf-8?q?4DliErOmmrP52f55PMoSKk5yxKVqoLORenAGf7RE7Pki7mfJRm1v0zq0Fdvy1CUwZ?= =?utf-8?q?CWFtWFsjmHuafn+lVGBCDTqmRMxABDzRA7cPOXwQfqlWjPGXkoLBNjjn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utf-8?q?dpgY80G/xxBpZlvrvcTJzjI7JKKjatTOLp2i/zPBhXRakgLcfL/THAfBVqGlvCNlm?= =?utf-8?q?w5O8cBv0Ns/AS44lge9iLa/5VKLfogS+a1CDhwUbHsVwyfYgN5BWoL7Q9GCjqb1R+?= =?utf-8?q?kcj2QUmdy1e2LcyEQM+zvMDYWVLZU7cVbgEzlIqG3Hkaaf1hBr+BXshznqJvnBwrr?= =?utf-8?q?joqNn4iBgtuYqrkdU56xYUzDuUe/JRXOo5PaZiTOUWtc4feV3NHBOPNk3BsEa0dCZ?= =?utf-8?q?qhLQGdj1wUKpt9k8faqIvZLxyFVdFr/KT8t3xFvy0TsytQUPbBabdME9KizqLRBgd?= =?utf-8?q?05E10dFn4eVqp+HqLhB6zjl7TEFeQTpGbg=3D=3D?= Content-ID: <482FCAA8E5EBBC409D3C030B985467DC@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: 342a1b83-df3f-48ba-e858-08dba8e66df6 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2023 23:19:43.4011 (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: g5LzW0cjsghHCCxmKErmsNXkcP8/ruZmWQPdPdYXJzaeM9hbTJXs0+VLNzvIIeTTmqMOTybsnKdp7r6zVc474E4iJLcLiygE51ZioFHnon8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR03MB6371 X-Proofpoint-ORIG-GUID: cFxyDfDyErvBYbpIwdkUT0NTCeuXyww6 X-Proofpoint-GUID: cFxyDfDyErvBYbpIwdkUT0NTCeuXyww6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-29_16,2023-08-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxscore=0 adultscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 mlxlogscore=943 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308290202 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é --- Since 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 3b797df82f..e58bbdf68d 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);