From patchwork Fri Nov 17 13:38:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 10062751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E21AF60352 for ; Fri, 17 Nov 2017 13:41:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC1382ACC4 for ; Fri, 17 Nov 2017 13:41:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD2862ACC6; Fri, 17 Nov 2017 13:41:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6E6F62ACC5 for ; Fri, 17 Nov 2017 13:41:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hcxCk+WOeF/HbHu7jAggHzgDDJIeVdh8U5MTjkvrQvc=; b=Pe48xNfOieX4al tC3B64LJG8DnzsBSezXyaAdufcAYQI5fb+UGMDZ+Tf6GBttrDh/GKvbdhOXhlr1/6cGoLwa/aJ0FI Wr/kt46cgmpYs+zUVxKNQ8On+19hrEpeBVgcrhH4j42GrhcQkVMXPUOPd76HANJo9votCzuF+286o apU/rCTotjgrxy9bti2+dr2V5LuiC8UgQ/Jj2AH0oP/SDCBkpu8t7ZGqGT4NYvPn2PJbz3LYGzQRg Fe3ESVmx2jX4jHPo5KGotJZ4ZXV65GyD2hGY7ch2HaDUD3954P7YwjqBtilcQZ6GwsxF3I0/hbAmB eYCDnlCHjpX96kCY7byA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eFgtB-0000pq-2i; Fri, 17 Nov 2017 13:41:01 +0000 Received: from mail-bl2nam02on0053.outbound.protection.outlook.com ([104.47.38.53] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eFgrb-0006ed-P4 for linux-arm-kernel@lists.infradead.org; Fri, 17 Nov 2017 13:39:38 +0000 Received: from BN6PR03CA0093.namprd03.prod.outlook.com (10.164.122.159) by BN6PR03MB2691.namprd03.prod.outlook.com (10.173.144.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Fri, 17 Nov 2017 13:39:04 +0000 Received: from BN1BFFO11FD020.protection.gbl (2a01:111:f400:7c10::1:160) by BN6PR03CA0093.outlook.office365.com (2603:10b6:405:6f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Fri, 17 Nov 2017 13:39:04 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD020.mail.protection.outlook.com (10.58.144.83) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Fri, 17 Nov 2017 13:39:03 +0000 Received: from fsr-fed1964-102.ea.freescale.net (fsr-fed1964-102.ea.freescale.net [10.171.73.17]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vAHDcbAr004692; Fri, 17 Nov 2017 06:39:00 -0700 From: To: , Subject: [PATCH 08/10] staging: fsl-mc: remove debug WARN_ONs doubling error checks Date: Fri, 17 Nov 2017 15:38:32 +0200 Message-ID: <20171117133834.4635-8-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171117133834.4635-1-laurentiu.tudor@nxp.com> References: <20171117133834.4635-1-laurentiu.tudor@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131553995440563817; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7966004)(336005)(39860400002)(39380400002)(376002)(346002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(2876002)(105606002)(2950100002)(54906003)(8656006)(97736004)(104016004)(6666003)(39060400002)(4326008)(7416002)(2906002)(6636002)(106466001)(8936002)(50226002)(77096006)(68736007)(5660300001)(85426001)(5003940100001)(189998001)(498600001)(86152003)(356003)(16586007)(1076002)(86362001)(53936002)(305945005)(316002)(33646002)(81166006)(8676002)(81156014)(110136005)(48376002)(36756003)(50466002)(47776003)(76176999)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2691; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD020; 1:B5T8UuZD7RkaFh+LfB8zMe0Nqv1tDBWcxsjFWRiO74DxqHEegxYgi3r9TNARwO3wTgIiQUWp9srb3Hod4UYbE65rpU236MoTcM/cEIxT0dLh45a8SKo2xn0aUY14VEG0 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a9fb3bc8-2ce4-4918-4509-08d52dc09179 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:BN6PR03MB2691; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2691; 3:2m38vJQHldvXvaML8hFPCzAqXduUjDuA2989vIC7r3ot3HuiC/AnyC/2n9dKs6PLotUf2xhelqhKiRoqh7kubBj/cAgPw/vUxvMtr19jNB2Tq22eFmC7oIpNjVAMrpypvFtQnR8+G2/qbR1D68snWqYBHBQe3jkgcEjKRmPm+ryNpGTxBgnjZT0FUic2N395KYdA7STBj9DzC2SB6c4NehIEIgXGuBJzNYEWHsBRhzhhokviPtxu4Slrq6h5elq8R8HJuV1yhl6VDa4W9odR5mrT90BbEpK8El/E8IdhEHhUjyYc+q91z74lUampj2Iwit1dK/rfWIKo92ipVDdKEpxsaHneD50q2MBQek16NNY=; 25:vW0b/mJs4ag0h75QMIOMs+v8FdgAszY1Y2CMzMMPvbosPmgQoz4ydm5FT8gB6KAVhGhz29Mmgu0JLMWXJDy2WYh2nzW5xt+Jr08CzJOlseWAj086r+3E1dSHzthjuQlDxi0sd5pG8S0NzTcM+IIzPhCqUD4MZ0051dedGJ2hskwiY6QnRy1f9UVb4j1Igd67SOdLg4T/f0EMpAOnypbbzQ4cjFiGeJ+7eyJvQn0Kg7n4KTOgaeO8/kq9Eb+GzdA8prN2QN//ygQAy+94kr74PorMfBkxc5JKfwspE+mfisAycQfpWlh6BVNKX5BrUN4RWByNPZeqimihlsbquJ/7Ug== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PR03MB2691: X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2691; 31:J9r+w+FP2G7oHhDewSbNcj2P+a+7hzP8bio48TSptFPgIIY8Qn6Hp1svEdVbn57CQvbZ6zF33laOA+Un3Cu/wYvuiz1JXDArcv5bdudFYza8NGUJMOuK51/EvVkgC+aKIRK70eIxEuWQ4ovpiB6sltWTHBdnMsXyQOpTWbk9zmmAfXhokmxk6YaqGMXI7S19Td3ZE8NNASXGgojGu3EXjK9t85Ja1z1+AJWDdle6tEM=; 4:SgqyMjydRH836dIhIPlFwFIhTPu1GZAE/OvMHjE6rE9wHkE9kq6cl5tcQmEhsLpNfMOUpIBCw6A286Jdm+oxKGksAN5K76Zu1Up3RhbqrgoKCBW+B/5/I4ywEulsIr/70tlXPFihwr+is8MluWNvMMV7sKexgcR8dd+U/ClusOUdonyw7ITU4kxSWjmD2Gzb6/+ij7LF436R5ZzMp/W1cpF26JL4F6qU7cEJaR0362rD7tR00sdMMd+qACFWzFeBVhMnU9xe/LW1Tpd5Y1ZIUUbbque0MLfGLwFLzHReQjypeSXfJDGwu7/5+OcbX74w X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231022)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123561025)(20161123559100)(20161123565025)(20161123563025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR03MB2691; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR03MB2691; X-Forefront-PRVS: 049486C505 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2691; 23:0Dhs10MFR8RqZDiOpTuRxF/G8ERekLS0nx0rgFJoQ?= =?us-ascii?Q?J0KwZhj2WUj6qt+VjwSKLeV5PQByIL26HTKoVnmyIIjMM9RzkN6VJtkZLsHM?= =?us-ascii?Q?4mnPg7RWw1H6TfEj7NQl30bG7COvVfpwGohRUFaG0WKsfT2/GXyXcSfz7hW/?= =?us-ascii?Q?u+V3tPyPVfO1WhlFDg73DI1FkzFDAtV6QLRyWHH0SOJPw75F/X9SWOoKaZPo?= =?us-ascii?Q?NgNKjIUmrV/63iRSojEa96YdkC40ohfGZgPyA8HHk4wpfikKY1hraOfjWmMp?= =?us-ascii?Q?0XSXGBc3b7yIVchRtbs3DUj5HCxnr//KBgVnhVlqEGmuSUHPJNipJGmJs99I?= =?us-ascii?Q?YGdjlzwinW5Kk7/sHGKVcLYVFvej/oIvLHuhOMiKMoxzbYf5sEx+cURQ6DtP?= =?us-ascii?Q?rC9Zo8mZFnKli+tii+CeLomYe+TxIQQKn59u0N8SfFOoOJBp23LwLYlIuMWp?= =?us-ascii?Q?ov7ejcSMJ+vyLavhgQqKbqyE3K9IKWm8YJF9uTT5B+hjhoyAX7bgo8abfijG?= =?us-ascii?Q?aMTFu5/Qfw7fh4rD6jbL8FbZnC/IAJ5lwHgjZXYjfhJAXphNCRb/mWrvLLR4?= =?us-ascii?Q?f73HaIAQBlu8Q9t6bm9EWrxi8LDyuAqPza/rF67O/ib+Y9UDH2GjHWgfk6Pl?= =?us-ascii?Q?ZzEPFZ2ygB1uOwMGc+KLmZHjAMp9IGjL02joO61j+evZQEZQUcAmmshjdk9v?= =?us-ascii?Q?tBzIWMiYsRpbyihH2JhNdb6iNmdV2lfntYhxJjX0OIOEddlemuZbBo7t9u9F?= =?us-ascii?Q?jBLllMS/O3ft3cb4OKDieFUnQiuyr0c5N/l3h3WG4m2I6hSNbeCjHmJRlaGS?= =?us-ascii?Q?skz/CepYLnhUfr4c1iLnxi7kWQUkNFRTIKY/gDu5D+CDJeIgiyzt0ZCdzKDo?= =?us-ascii?Q?YrVEUulg04iCc1igrOfIbJYnfH+A8KWShWF0iG/PVjUn8TNF8+Q7vUloyuEz?= =?us-ascii?Q?1PuDf9jT8FIGRO2gtkZgPo2NAMmWb/Wl835g1X1jwQ3lVYGRr0OMY4NKYkqX?= =?us-ascii?Q?oRzEc/PyFnKZznmvQYYgGY+FAwcbmZ7q6Q34tJ5+e4FugtA1o73XqjNyevxt?= =?us-ascii?Q?Pc5Dt7IMTE469th/ijwpAlEe6torazJvxUDIGlztKil8jDwwnU3Mf+rDv1Rx?= =?us-ascii?Q?D2EZa1zQP+DikJsxQZC+3WtrR88g6/7jmnqH3dWXAkdYzev7aEWq4fjtbACy?= =?us-ascii?Q?egnRG2ZwOoanff9oYJdKALJMm6VxKo0GwkZtjNuCZn9FnhtOj9/j9aFbWAp0?= =?us-ascii?Q?otSau6B+2j+Sbu1tSqrcCbjfx+RQ4sUGKFCG7w2VD+2YrgS5lKaSO9ZbHLTk?= =?us-ascii?B?UT09?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2691; 6:i58JJoTSiYtrlIyQ9HZCJt8ckfLllE9pbCTzE3nakoFNPAx8pF53f1nEyOSCu+i9jMsgE3lDzfoJBHIH+VR4MluBXiyhRAdIJiLnR/WE7DoCKv72IGuoKWNARNnNKWaV+y0sx+s9rnzN+Hghwq0++88j5z4TCG2YP9Jebb2H/51/iiGOHdMRnArBL6snX5LY7X6akjz7uFH/DyyR7+7pOXlLGyepyO6ydkKiSB9/n0tV1HmCWB2lCmcGUUYtDK8POl6N1EOaNHdmkldc+Oy0BCao47r32PhedcHVx+LZVPRVfPGXc587S/2M9ndYxN7LsaTPSfrc/3PBolFjnGk87ltYl2/JR1yxdLSfzk+2WoY=; 5:x5hlJcOhXfc8TYaBzNtR+3Mgm0a3lWro4P9P4COcQSY1UU0i+bWcxk8EwsxgaqFwPuAS/6H0X/YczQKqHiX8SIfPhA0RVuUEPV2Xns4QbgDPZ4s40vADWq6ol4xYcR1zcomRoy0nZOR9TrU9PevI6nFi8ugOdo6Eku26bOZcD2s=; 24:WwBTDe/xRj4KRCoXrkcgO5u7rpDW/Isgft2xjwCOXTt/bkGaXLPt+XlP2dviSOkGgg25ZrA655YIJhA7LhhkrVxl6NPbqNJ8YSq9LfH81gA=; 7:XIacXI7Gh/g3ZtqIGsOs+M4KnwJld0i52qSvd7iefCub77tSvW0PG+zjVvod/TOpaBaeB4kwQuaRw/Dy7IvsUQVKaf0vhObZswFgZcjSyP8amUWV3sXDnLNQPpjsINGClRvxICp4gfMBu0pPRl2593UU4chzznp9jZSHacosiHD9AB0KU7Foa1/ipmIhd6j4C2y9qV3AN1crrNv8CmPvfwUkiaEemy6GzeYcvncgD2NVfVbRzVoiF5WsPoGIZl83 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2017 13:39:03.8379 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9fb3bc8-2ce4-4918-4509-08d52dc09179 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2691 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171117_053924_200309_C3AE3D52 X-CRM114-Status: GOOD ( 16.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, stuyoder@gmail.com, roy.pledge@nxp.com, linux-kernel@vger.kernel.org, leoyang.li@nxp.com, bogdan.purcareata@nxp.com, linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Laurentiu Tudor A lot of error checks are doubled by debug WARN_ONs. Given that the driver was thoroughly debugged and is in a stable state, it's time to drop them. Signed-off-by: Laurentiu Tudor --- drivers/staging/fsl-mc/bus/dprc-driver.c | 20 ++--- drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 86 +++++++++++----------- drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 8 +- drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 14 ++-- .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 4 +- drivers/staging/fsl-mc/bus/mc-io.c | 13 ++-- drivers/staging/fsl-mc/bus/mc-sys.c | 5 +- 7 files changed, 73 insertions(+), 77 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index d6a84dd..28a6b87 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -382,11 +382,11 @@ static irqreturn_t dprc_irq0_handler_thread(int irq_num, void *arg) dev_dbg(dev, "DPRC IRQ %d triggered on CPU %u\n", irq_num, smp_processor_id()); - if (WARN_ON(!(mc_dev->flags & FSL_MC_IS_DPRC))) + if (!(mc_dev->flags & FSL_MC_IS_DPRC)) return IRQ_HANDLED; mutex_lock(&mc_bus->scan_mutex); - if (WARN_ON(!msi_desc || msi_desc->irq != (u32)irq_num)) + if (!msi_desc || msi_desc->irq != (u32)irq_num) goto out; status = 0; @@ -593,20 +593,20 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) bool msi_domain_set = false; u16 major_ver, minor_ver; - if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0)) + if (strcmp(mc_dev->obj_desc.type, "dprc") != 0) return -EINVAL; - if (WARN_ON(dev_get_msi_domain(&mc_dev->dev))) + if (dev_get_msi_domain(&mc_dev->dev)) return -EINVAL; if (!mc_dev->mc_io) { /* * This is a child DPRC: */ - if (WARN_ON(!dev_is_fsl_mc(parent_dev))) + if (!dev_is_fsl_mc(parent_dev)) return -EINVAL; - if (WARN_ON(mc_dev->obj_desc.region_count == 0)) + if (mc_dev->obj_desc.region_count == 0) return -EINVAL; region_size = resource_size(mc_dev->regions); @@ -634,7 +634,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) */ struct irq_domain *mc_msi_domain; - if (WARN_ON(dev_is_fsl_mc(parent_dev))) + if (dev_is_fsl_mc(parent_dev)) return -EINVAL; error = fsl_mc_find_msi_domain(parent_dev, @@ -745,12 +745,12 @@ static int dprc_remove(struct fsl_mc_device *mc_dev) int error; struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev); - if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0)) + if (strcmp(mc_dev->obj_desc.type, "dprc") != 0) return -EINVAL; - if (WARN_ON(!mc_dev->mc_io)) + if (!mc_dev->mc_io) return -EINVAL; - if (WARN_ON(!mc_bus->irq_resources)) + if (!mc_bus->irq_resources) return -EINVAL; if (dev_get_msi_domain(&mc_dev->dev)) diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c index d472a85..f7fbebd 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c @@ -41,25 +41,25 @@ static int __must_check fsl_mc_resource_pool_add_device(struct fsl_mc_bus struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; int error = -EINVAL; - if (WARN_ON(pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)) + if (pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES) goto out; - if (WARN_ON(!fsl_mc_is_allocatable(mc_dev->obj_desc.type))) + if (!fsl_mc_is_allocatable(mc_dev->obj_desc.type)) goto out; - if (WARN_ON(mc_dev->resource)) + if (mc_dev->resource) goto out; res_pool = &mc_bus->resource_pools[pool_type]; - if (WARN_ON(res_pool->type != pool_type)) + if (res_pool->type != pool_type) goto out; - if (WARN_ON(res_pool->mc_bus != mc_bus)) + if (res_pool->mc_bus != mc_bus) goto out; mutex_lock(&res_pool->mutex); - if (WARN_ON(res_pool->max_count < 0)) + if (res_pool->max_count < 0) goto out_unlock; - if (WARN_ON(res_pool->free_count < 0 || - res_pool->free_count > res_pool->max_count)) + if (res_pool->free_count < 0 || + res_pool->free_count > res_pool->max_count) goto out_unlock; resource = devm_kzalloc(&mc_bus_dev->dev, sizeof(*resource), @@ -105,25 +105,25 @@ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device struct fsl_mc_resource *resource; int error = -EINVAL; - if (WARN_ON(!fsl_mc_is_allocatable(mc_dev->obj_desc.type))) + if (!fsl_mc_is_allocatable(mc_dev->obj_desc.type)) goto out; resource = mc_dev->resource; - if (WARN_ON(!resource || resource->data != mc_dev)) + if (!resource || resource->data != mc_dev) goto out; mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); mc_bus = to_fsl_mc_bus(mc_bus_dev); res_pool = resource->parent_pool; - if (WARN_ON(res_pool != &mc_bus->resource_pools[resource->type])) + if (res_pool != &mc_bus->resource_pools[resource->type]) goto out; mutex_lock(&res_pool->mutex); - if (WARN_ON(res_pool->max_count <= 0)) + if (res_pool->max_count <= 0) goto out_unlock; - if (WARN_ON(res_pool->free_count <= 0 || - res_pool->free_count > res_pool->max_count)) + if (res_pool->free_count <= 0 || + res_pool->free_count > res_pool->max_count) goto out_unlock; /* @@ -187,11 +187,11 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, FSL_MC_NUM_POOL_TYPES); *new_resource = NULL; - if (WARN_ON(pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)) + if (pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES) goto out; res_pool = &mc_bus->resource_pools[pool_type]; - if (WARN_ON(res_pool->mc_bus != mc_bus)) + if (res_pool->mc_bus != mc_bus) goto out; mutex_lock(&res_pool->mutex); @@ -206,12 +206,12 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, goto out_unlock; } - if (WARN_ON(resource->type != pool_type)) + if (resource->type != pool_type) goto out_unlock; - if (WARN_ON(resource->parent_pool != res_pool)) + if (resource->parent_pool != res_pool) goto out_unlock; - if (WARN_ON(res_pool->free_count <= 0 || - res_pool->free_count > res_pool->max_count)) + if (res_pool->free_count <= 0 || + res_pool->free_count > res_pool->max_count) goto out_unlock; list_del_init(&resource->node); @@ -231,15 +231,15 @@ void fsl_mc_resource_free(struct fsl_mc_resource *resource) struct fsl_mc_resource_pool *res_pool; res_pool = resource->parent_pool; - if (WARN_ON(resource->type != res_pool->type)) + if (resource->type != res_pool->type) return; mutex_lock(&res_pool->mutex); - if (WARN_ON(res_pool->free_count < 0 || - res_pool->free_count >= res_pool->max_count)) + if (res_pool->free_count < 0 || + res_pool->free_count >= res_pool->max_count) goto out_unlock; - if (WARN_ON(!list_empty(&resource->node))) + if (!list_empty(&resource->node)) goto out_unlock; list_add_tail(&resource->node, &res_pool->free_list); @@ -278,13 +278,13 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, struct fsl_mc_resource *resource = NULL; *new_mc_adev = NULL; - if (WARN_ON(mc_dev->flags & FSL_MC_IS_DPRC)) + if (mc_dev->flags & FSL_MC_IS_DPRC) goto error; - if (WARN_ON(!dev_is_fsl_mc(mc_dev->dev.parent))) + if (!dev_is_fsl_mc(mc_dev->dev.parent)) goto error; - if (WARN_ON(pool_type == FSL_MC_POOL_DPMCP)) + if (pool_type == FSL_MC_POOL_DPMCP) goto error; mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); @@ -294,7 +294,7 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, goto error; mc_adev = resource->data; - if (WARN_ON(!mc_adev)) + if (!mc_adev) goto error; *new_mc_adev = mc_adev; @@ -317,9 +317,9 @@ void fsl_mc_object_free(struct fsl_mc_device *mc_adev) struct fsl_mc_resource *resource; resource = mc_adev->resource; - if (WARN_ON(resource->type == FSL_MC_POOL_DPMCP)) + if (resource->type == FSL_MC_POOL_DPMCP) return; - if (WARN_ON(resource->data != mc_adev)) + if (resource->data != mc_adev) return; fsl_mc_resource_free(resource); @@ -348,8 +348,8 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, struct fsl_mc_resource_pool *res_pool = &mc_bus->resource_pools[FSL_MC_POOL_IRQ]; - if (WARN_ON(irq_count == 0 || - irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS)) + if (irq_count == 0 || + irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS) return -EINVAL; error = fsl_mc_msi_domain_alloc_irqs(&mc_bus_dev->dev, irq_count); @@ -405,13 +405,13 @@ void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus) struct fsl_mc_resource_pool *res_pool = &mc_bus->resource_pools[FSL_MC_POOL_IRQ]; - if (WARN_ON(!mc_bus->irq_resources)) + if (!mc_bus->irq_resources) return; - if (WARN_ON(res_pool->max_count == 0)) + if (res_pool->max_count == 0) return; - if (WARN_ON(res_pool->free_count != res_pool->max_count)) + if (res_pool->free_count != res_pool->max_count) return; INIT_LIST_HEAD(&res_pool->free_list); @@ -435,11 +435,11 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev) struct fsl_mc_bus *mc_bus; struct fsl_mc_resource_pool *res_pool; - if (WARN_ON(mc_dev->irqs)) + if (mc_dev->irqs) return -EINVAL; irq_count = mc_dev->obj_desc.irq_count; - if (WARN_ON(irq_count == 0)) + if (irq_count == 0) return -EINVAL; if (strcmp(mc_dev->obj_desc.type, "dprc") == 0) @@ -447,7 +447,7 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev) else mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent)); - if (WARN_ON(!mc_bus->irq_resources)) + if (!mc_bus->irq_resources) return -EINVAL; res_pool = &mc_bus->resource_pools[FSL_MC_POOL_IRQ]; @@ -500,7 +500,7 @@ void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev) struct fsl_mc_bus *mc_bus; struct fsl_mc_device_irq **irqs = mc_dev->irqs; - if (WARN_ON(!irqs)) + if (!irqs) return; irq_count = mc_dev->obj_desc.irq_count; @@ -510,7 +510,7 @@ void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev) else mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent)); - if (WARN_ON(!mc_bus->irq_resources)) + if (!mc_bus->irq_resources) return; for (i = 0; i < irq_count; i++) { @@ -575,11 +575,11 @@ static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev) struct fsl_mc_bus *mc_bus; int error; - if (WARN_ON(!fsl_mc_is_allocatable(mc_dev->obj_desc.type))) + if (!fsl_mc_is_allocatable(mc_dev->obj_desc.type)) return -EINVAL; mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); - if (WARN_ON(!dev_is_fsl_mc(&mc_bus_dev->dev))) + if (!dev_is_fsl_mc(&mc_bus_dev->dev)) return -EINVAL; mc_bus = to_fsl_mc_bus(mc_bus_dev); @@ -604,7 +604,7 @@ static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev) { int error; - if (WARN_ON(!fsl_mc_is_allocatable(mc_dev->obj_desc.type))) + if (!fsl_mc_is_allocatable(mc_dev->obj_desc.type)) return -EINVAL; if (mc_dev->resource) { diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c index 1c2fd8d..854bd80 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c @@ -284,9 +284,9 @@ static int mc_get_version(struct fsl_mc_io *mc_io, static void fsl_mc_get_root_dprc(struct device *dev, struct device **root_dprc_dev) { - if (WARN_ON(!dev)) { + if (!dev) { *root_dprc_dev = NULL; - } else if (WARN_ON(!dev_is_fsl_mc(dev))) { + } else if (!dev_is_fsl_mc(dev)) { *root_dprc_dev = NULL; } else { *root_dprc_dev = dev; @@ -532,7 +532,7 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, /* * device being added is the root DPRC device */ - if (WARN_ON(!mc_io)) { + if (!mc_io) { error = -EINVAL; goto error_cleanup_dev; } @@ -814,7 +814,7 @@ static int fsl_mc_bus_remove(struct platform_device *pdev) { struct fsl_mc *mc = platform_get_drvdata(pdev); - if (WARN_ON(!fsl_mc_is_root_dprc(&mc->root_mc_bus_dev->dev))) + if (!fsl_mc_is_root_dprc(&mc->root_mc_bus_dev->dev)) return -EINVAL; fsl_mc_device_remove(mc->root_mc_bus_dev); diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c index 0ce6117..625ba07 100644 --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c @@ -47,7 +47,7 @@ static void fsl_mc_msi_update_dom_ops(struct msi_domain_info *info) { struct msi_domain_ops *ops = info->ops; - if (WARN_ON(!ops)) + if (!ops) return; /* @@ -73,7 +73,7 @@ static void __fsl_mc_msi_write_msg(struct fsl_mc_device *mc_bus_dev, if (msi_desc->msg.address_lo == 0x0 && msi_desc->msg.address_hi == 0x0) return; - if (WARN_ON(!owner_mc_dev)) + if (!owner_mc_dev) return; irq_cfg.paddr = ((u64)msi_desc->msg.address_hi << 32) | @@ -136,7 +136,7 @@ static void fsl_mc_msi_update_chip_ops(struct msi_domain_info *info) { struct irq_chip *chip = info->chip; - if (WARN_ON(!chip)) + if (!chip) return; /* @@ -238,7 +238,7 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev, struct irq_domain *msi_domain; int error; - if (WARN_ON(!list_empty(dev_to_msi_list(dev)))) + if (!list_empty(dev_to_msi_list(dev))) return -EINVAL; error = fsl_mc_msi_alloc_descs(dev, irq_count); @@ -246,7 +246,7 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev, return error; msi_domain = dev_get_msi_domain(dev); - if (WARN_ON(!msi_domain)) { + if (!msi_domain) { error = -EINVAL; goto cleanup_msi_descs; } @@ -274,12 +274,12 @@ void fsl_mc_msi_domain_free_irqs(struct device *dev) struct irq_domain *msi_domain; msi_domain = dev_get_msi_domain(dev); - if (WARN_ON(!msi_domain)) + if (!msi_domain) return; msi_domain_free_irqs(msi_domain, dev); - if (WARN_ON(list_empty(dev_to_msi_list(dev)))) + if (list_empty(dev_to_msi_list(dev))) return; fsl_mc_msi_free_descs(dev); diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c index 947378f..6d81ac0 100644 --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c @@ -32,11 +32,11 @@ static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain, struct fsl_mc_device *mc_bus_dev; struct msi_domain_info *msi_info; - if (WARN_ON(!dev_is_fsl_mc(dev))) + if (!dev_is_fsl_mc(dev)) return -EINVAL; mc_bus_dev = to_fsl_mc_device(dev); - if (WARN_ON(!(mc_bus_dev->flags & FSL_MC_IS_DPRC))) + if (!(mc_bus_dev->flags & FSL_MC_IS_DPRC)) return -EINVAL; /* diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index 5530856..3cbf92d 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -42,13 +42,10 @@ static int fsl_mc_io_set_dpmcp(struct fsl_mc_io *mc_io, { int error; - if (WARN_ON(!dpmcp_dev)) + if (mc_io->dpmcp_dev) return -EINVAL; - if (WARN_ON(mc_io->dpmcp_dev)) - return -EINVAL; - - if (WARN_ON(dpmcp_dev->mc_io)) + if (dpmcp_dev->mc_io) return -EINVAL; error = dpmcp_open(mc_io, @@ -204,7 +201,7 @@ int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev, if (mc_dev->flags & FSL_MC_IS_DPRC) { mc_bus_dev = mc_dev; } else { - if (WARN_ON(!dev_is_fsl_mc(mc_dev->dev.parent))) + if (!dev_is_fsl_mc(mc_dev->dev.parent)) return error; mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); @@ -267,10 +264,10 @@ void fsl_mc_portal_free(struct fsl_mc_io *mc_io) dpmcp_dev = mc_io->dpmcp_dev; resource = dpmcp_dev->resource; - if (WARN_ON(!resource || resource->type != FSL_MC_POOL_DPMCP)) + if (!resource || resource->type != FSL_MC_POOL_DPMCP) return; - if (WARN_ON(resource->data != dpmcp_dev)) + if (resource->data != dpmcp_dev) return; fsl_destroy_mc_io(mc_io); diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index a2854e5..db3636d 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -85,7 +85,7 @@ static int mc_status_to_error(enum mc_cmd_status status) [MC_CMD_STATUS_INVALID_STATE] = -ENODEV, }; - if (WARN_ON((u32)status >= ARRAY_SIZE(mc_status_to_error_map))) + if ((u32)status >= ARRAY_SIZE(mc_status_to_error_map)) return -EINVAL; return mc_status_to_error_map[status]; @@ -273,8 +273,7 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd) enum mc_cmd_status status; unsigned long irq_flags = 0; - if (WARN_ON(in_irq() && - !(mc_io->flags & FSL_MC_IO_ATOMIC_CONTEXT_PORTAL))) + if (in_irq() && !(mc_io->flags & FSL_MC_IO_ATOMIC_CONTEXT_PORTAL)) return -EINVAL; if (mc_io->flags & FSL_MC_IO_ATOMIC_CONTEXT_PORTAL)