From patchwork Sat Dec 2 01:27:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13476710 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 B6933C4167B for ; Sat, 2 Dec 2023 01:27:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.645830.1008244 (Exim 4.92) (envelope-from ) id 1r9Emu-0002IG-An; Sat, 02 Dec 2023 01:27:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 645830.1008244; Sat, 02 Dec 2023 01:27:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9Emu-0002HK-5C; Sat, 02 Dec 2023 01:27:20 +0000 Received: by outflank-mailman (input) for mailman id 645830; Sat, 02 Dec 2023 01:27:18 +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 1r9Ems-000271-Nj for xen-devel@lists.xenproject.org; Sat, 02 Dec 2023 01:27:18 +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 ebfa4255-90b1-11ee-9b0f-b553b5be7939; Sat, 02 Dec 2023 02:27:14 +0100 (CET) Received: from pps.filterd (m0174680.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B20exWZ004068; Sat, 2 Dec 2023 01:27:12 GMT Received: from eur02-vi1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2040.outbound.protection.outlook.com [104.47.11.40]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3uqt8mg1hm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 Dec 2023 01:27:12 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DU0PR03MB8599.eurprd03.prod.outlook.com (2603:10a6:10:3e6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Sat, 2 Dec 2023 01:27:07 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%6]) with mapi id 15.20.7046.027; Sat, 2 Dec 2023 01:27:07 +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: ebfa4255-90b1-11ee-9b0f-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hP60KBmfNMFnjfgi1NsdMQEhxrg1U9g4M9jo8A6E9qNb9kDA9lmalLgcqOL77+sm4L1FyYepuJiiMlqbGh8oGPY7NHfTpDpbmGmdKxXgPM9pZ503bdwRHi4ntmmhfSHrqDlCVFS9mRKXag7RmMqHShJavjjDb6MSdNOJsk8NKs3iW36He4ugQLtEjcT9U1SUfAJ11sl2xAvvxC6U/4nHaCFn/vsphczfKc1KB0VjM1aINSuoqZxYoFlufUBedqC9k/mZxAf2W5GQm6HUDl6pKTMF3EQok/G/3Q+f4mYAfWQfnTgClnJAdRUPkrKDUzfUjzi3PDfsf4PZ0zjAuiqjbg== 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=SFwYHxU24LM47Wx7eKT7t91aTd5L+oJ//Tk/2jLWySA=; b=euaBkwaH4JkwfYUsiOJbB8lyo2DSGT3Pp19b0KD/ttzezvKzta83irEPVvdLDNDqfmUqZfeSeQGo3E7DBkHmoxmBltOtBuSU/IyDVpg/qVtFmCRC7Pj4vT70ri/7IX63PB/igZNrdU6zvg3Ig7deQBDy4r2WG/gWa99y0KJROavN2EbR6ToHKjUhlYs32DQD72egn8nCurnj4V5Kx0Raho1mkVKsHqMP/ciUuHWYlYeI0j9qnOSwpQxUKPZookA1a33aeiH6KRgjDMDXlil74II88BfSVyI7vI+4upXZ5qbMs24aMMFIHE+c/fpYEelPdtCpTWfZ84ItW8+XeXVHCA== 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=SFwYHxU24LM47Wx7eKT7t91aTd5L+oJ//Tk/2jLWySA=; b=P6GtjoKrKttcLr4AYJm9tfR4Cm7oSOmuKtCFLa/x0kIjrtkE7EcKdWpRkA74IRIVmfxLp6pXm6usY3Ic8RtEGBJcbEb1NwV03BTl1b2keVyktQFKdRwaiksjRiabCqDwfnjqyyP1Z8pcb6CV6AGewjtj5V+ypD48PdvBXxXZyHmD394Fu642H2+29r/+STMyZP5RGJplhGn1DgrWNCvz+SalpB3fQGLjKEUI/olq7J6H7dLYsyuOoaKBZqv4RQ34kHpuMae3Tdj9VLY6O4qczxibzyXjEdOhfNrbchXkaYV9pFDeNntq5G72pyWmoduGaD6+r0tqW5vl/JCp0Dsk1w== 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 v11 06/17] vpci/header: rework exit path in init_bars Thread-Topic: [PATCH v11 06/17] vpci/header: rework exit path in init_bars Thread-Index: AQHaJL6n1kPp1+DEXkyG3DA4rY4zlA== Date: Sat, 2 Dec 2023 01:27:04 +0000 Message-ID: <20231202012556.2012281-7-volodymyr_babchuk@epam.com> References: <20231202012556.2012281-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231202012556.2012281-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_|DU0PR03MB8599:EE_ x-ms-office365-filtering-correlation-id: 9198ba8e-0535-4f38-dfc3-08dbf2d5cc2b 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: is4K3x+RaHsNn5pOgEiOOEKDVwXh7Y6YF4KcfKgo6iXJObxSNcTYyiJ9sVsXS8i1Cxf2/fXhY/RtoQy/SbEMwqxJ/oTgC6vug6PkMkMbO2iqwJYIwT4HnM1JVtH89AxWEViW0oFgnNOd9VJ0r4ow/yqxelLdo8d0QIxEt58nUK6XuWW2dRMCrItiIbu9pbgs6M0PAtMjmgqi/yh1kiAN8ACdP/bR0Lj5mtWX1J3NGD0+JsB0Gqfk91qmC/NEmtbk55ibPASYvs4RsW/nHlURoHdryK2ndeUGrB7x8rTb4c5aRZ/eVjE8SK6imTa+JqGxi0Q85fLQwAsvVzI75wOl/S7VXO49jnq/0AohqriaV4a2s5n6Lvao6v4S+RqVo5vPDbNiygULFZMKOplflS06RR5ciyXtKfGLfQ24Vi/6a3dz/guc72oBe1w28aDGgJCNYwqoWVooRxIldxQWhXFRKcTpVgiADaGw7he6ndFLpgrrZbf1d1hFsXYUw4YI7bcPD0qB/W3ghS+pywiekB95EITkA/V4afqWH119yTyquF6gwPp7jjvDvalgMBOJJpcidKG0DBMtb/zBYNXBazfv7Rnb3Ix88v5G8fwg1z7tVvyI5QHSdj2fUMC1usApD8nG 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)(136003)(396003)(39860400002)(346002)(376002)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(5660300002)(86362001)(4326008)(8676002)(8936002)(2906002)(38070700009)(41300700001)(36756003)(2616005)(1076003)(6512007)(6506007)(55236004)(83380400001)(6486002)(478600001)(26005)(71200400001)(6666004)(38100700002)(122000001)(316002)(91956017)(54906003)(64756008)(66446008)(6916009)(66476007)(66556008)(76116006)(66946007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?7hcuBPTzhabFIoqgXe/WK+Nu0gHc?= =?utf-8?q?i7CZKIZT6K2eeHf1ayqpBROIMhXjtdlkFdyPNR1OlLNFVUfIEUYv6bks2kny+ktIx?= =?utf-8?q?QclxFzvoKb68Mmd1hb1Km8UL8LbbE0ZwkcMGpseb+q+V99Fa7sU0XKAMgyALEz7+s?= =?utf-8?q?L5j10gGxsjAd74FbyI+oqsUp65Pr45gNLNQSw6cfi2fhDi+AgiO3WX+6f2WR3Wo3C?= =?utf-8?q?Aha49NSAj9PU5FNOQmLXO+tQNcG0wh2XtC2avLfxiJ9zIHfcOjeNfGkEHCCz3Sd8J?= =?utf-8?q?zwGbLAQ9DiKVLoU1InZvsz/Nd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k8Y37SodtuTJFZvxkixiKfm2?= =?utf-8?q?Jzaf1YCjkVAinF6jqgFRm2mhRopJ/ts0LG1CkNGZuw6MEMTXJ1TIvVetwb3OShlLe?= =?utf-8?q?k6AtIqRnV0xov3lDfz38BkcvfsdqM/wRbT5vR4mn55xgBKMU0yE2KkSlXhXFhhpBG?= =?utf-8?q?hDXu2lrAg2CEQpRdT2ucdFFJ3HGp8gLRPXwO/4KJbWn5w8cyZR/e404ngFr3UENcq?= =?utf-8?q?vtz/BO+y8j/uSTxIZEYNiKiGQKlt8+NvZeRCXEN7abPjScrtGmz1yUrhlEkCL6vLl?= =?utf-8?q?aV/JawBekWHXtsSoWlSosej/8aUnXhY+x2PF0iUPsOZZ+eVWYLOBs12khHSKcu3cz?= =?utf-8?q?UIyIJIlTHNJU/CWmntAPSzY/KB/1w/op+Q=3D=3D?= Content-ID: 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: 9198ba8e-0535-4f38-dfc3-08dbf2d5cc2b X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2023 01:27:04.1397 (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: bPrDjI8ZhUaHNyVjvH0tWsCZwlrQWOQKz+4lQKh6DTveeedSLI32RgMW7zprGVlSmtTLnSHIE4L4zWu8MJXey8LeBehgPHEbKIlrCCIKYsk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8599 X-Proofpoint-ORIG-GUID: T730irxzVb2dsD5u96ynCg5bhDM3i3Kk X-Proofpoint-GUID: T730irxzVb2dsD5u96ynCg5bhDM3i3Kk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_24,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 phishscore=0 suspectscore=0 impostorscore=0 mlxscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=930 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020008 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 v11: - Do not remove empty line between "goto fail;" and "continue;" In v10: - Added Roger's A-b tag. In v9: - New in v9 --- xen/drivers/vpci/header.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index ec6c93eef6..e6a1d58c42 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -581,10 +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 +601,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 +616,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 +638,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);