From patchwork Mon Mar 26 19:05:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Pledge X-Patchwork-Id: 10308513 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 8895C60353 for ; Mon, 26 Mar 2018 19:07:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72D9928DDA for ; Mon, 26 Mar 2018 19:07:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6710D29766; Mon, 26 Mar 2018 19:07:07 +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=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 B200428DDA for ; Mon, 26 Mar 2018 19:07:06 +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:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HafB8twI38/KExYrBAbRTnwN68yWkc0NwWBI+gf+Vkk=; b=fZfVtpH3mzMose 8kA0/W0sonmQUCUqSl/dcjFE/jO2obgWo8D1LcWYC1TtvxqUuGBhm7z8MRzEGoPLdcI402xRkrZ2B NSLwKlNpoBrTk0z1aKyGEmAjWQ6neGW2/4zuyTKl48Q6G7V+9vZQ5GB1UswXyvKAh30rC51VYCC0q GC1vtd9TejS13jspV0d53HyVbKPPvZHcSv4MfYQPLVsEi/+vFrbHku7oGFi23f8Urd8q1ujD4g8BJ UVxTc8ZYjvl82a18Omg3CDWq0hBBn1NMyCm66hZlmnhASquddX4lWULcwVfrmFQYY7cS8Fl3ApDQA r7Px08bt9XoWmTm+QvxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0XSP-0002wc-1X; Mon, 26 Mar 2018 19:07:01 +0000 Received: from mail-db5eur01on0074.outbound.protection.outlook.com ([104.47.2.74] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0XRf-0002L4-Po for linux-arm-kernel@lists.infradead.org; Mon, 26 Mar 2018 19:06:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kwjCaHOrkX80MOEepBFVU8ZqTyysWXQyL7Y/xcB7qts=; b=eb3eWdZXX9owkdwMBzze+kylyxTWE9GD0uaAraL7GiYHuw2NB7aD7YEvXLQlpmGBFGx/mAzUjdrFTOq9oCmF3oiYupVSfAirCZ7X6Ivf1FKR6zuyzq7CxMEnxA7y3qYMHhEuYjVlLkGrmIJF1GAPKnjB02SSHvhv+bBIMKWGBgs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=roy.pledge@nxp.com; Received: from otc-sw1.am.freescale.net (192.88.168.1) by AM5PR04MB2993.eurprd04.prod.outlook.com (2603:10a6:206:a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10; Mon, 26 Mar 2018 19:05:58 +0000 From: Roy Pledge To: devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/4] drivers/staging/fsl-mc: Fix DPIO error path issues Date: Mon, 26 Mar 2018 15:05:32 -0400 Message-Id: <1522091134-24646-3-git-send-email-roy.pledge@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522091134-24646-1-git-send-email-roy.pledge@nxp.com> References: <1522091134-24646-1-git-send-email-roy.pledge@nxp.com> MIME-Version: 1.0 X-Originating-IP: [192.88.168.1] X-ClientProxiedBy: DM5PR1501CA0025.namprd15.prod.outlook.com (2603:10b6:4:9d::38) To AM5PR04MB2993.eurprd04.prod.outlook.com (2603:10a6:206:a::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: da6638e5-42fe-4f3d-3fd5-08d5934c9d60 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM5PR04MB2993; X-Microsoft-Exchange-Diagnostics: 1; AM5PR04MB2993; 3:fXyMqSJr86d9GU5iPom5bHKYHpx8pQGKvx96ERleZGHMvCbYYIFKsT/ohnFSExTMtbWz+al27iuYI23A5FeO/WAH/FGCVm75vTfYyOPpqu9jrMuXRTf2/ASVGMHrecNUmmCWJ/6BJIel4XN9FNlPzsarQDmxERS0CQccKHgzhuYHODQRRjSmmZ/NN+BVjqt9qK75HXeqzKUP3My7scLmPn6RiNEZuss59wuXol+v4gm9oGgMXgX1gZXVq3+tVnCv; 25:0J0JIxcnq+Ry2uCUkbxzBhZ7b5U1UCilM4lviyWh2ti7WcqltQbWX+SHQsxz+h5RcYIlwPg8/2l75OBmvcwFRknrFniM/OtkU/6xKV13+i6WgM0e0F9e6pNQkapmGO1NvRSxm/gwvJvjhH5YtLmLHFjkuUGnv6/mMBrlPq8E/UIIX22CwCJQofGYsnPMdoiQinb+ni96Xo2s1PclYAOFjWkzWuCCgixkPCuedCo5sf3AfluGebVSBTZsJhsZ3tOL71SPncnrANu4bSjeZpH5+JbCqfukGx2Wsiq8QH1w2Ei9FUljSzfTALtEa4493NEvGUdKlc879eIdUmJV+OF90Q==; 31:Y7ZbDIxlhxUIYrr8rI5iTHDo8tleomFwkNqoI4pLNU8Hwy6GsK1EoqAwAVu2ruIn4xfjn7yVYuA8q/XHN9mULV375HEmPiZrJgRQasaY0IzSqwXHk9hzzulY4yXuferY/wf1EvJKoGBFDXq7koP6p9/F3azknA4JUNnL7djIlTNrJ/dBxDBPqiDhEUa3VXHEba9vAEryGUPkKFztmQVRodQs1GKcoO8enK0fhyM6mc4= X-MS-TrafficTypeDiagnostic: AM5PR04MB2993: X-Microsoft-Exchange-Diagnostics: 1; AM5PR04MB2993; 20:3t6FeeiPiPn4AVyAr0Qh0E3u5wANif5hfsqEIf3j16AnfZTIS8AOzq+o2bYuoQ1OZtmilflp0WOTP5Qq6xZ7aKf7O695jSA0m4yGlE55ohMe69xeJhKbcB6LgctLa2BA1IAeH5UgaL0X0v2tFNveauFomP0hG+Vm8hN8t3ovCv3WnNQKmXXb7/xZ36fUiMo/J5Qy37AZqUvw0Da2T3w5D2zksKiYY5HrJHqMYXbRa0ymiUpDPnZqfAGo8eAS4Y6mYQ9swLQHL8i4BvoCQtYUKHHOyFkh8uPvNIQLeBf81GhBJisWaAB/yfc9hCCXQnbToWnTTaU0yn5XFvCVveJxbNIRYXHabCadE9dg+rT0Xd4Sx6YLLyS2dVgUi667IsrUl+AwqSO4mAE5a+HgftoIXTf1dBZ7xL2eIIousgEu23KnqKfwiVQG/Uq93BO8oYZxFLmSLFhTUZTLoQS/lpT7MITMEqptnix4oPtUG9K3i9g451rc7TDQy4Z1NBH2Rro7; 4:ESlfU6Nq3uKGnQ65mz2qLOywF4yl+PSNkz0QyTkTh03Yj4rNAKGfjDkS3MzYkeXL1kZQf7gL6OqUrtoS07f1gbKhhS7Ga0oxoVHjFObpu4bHqTJaVsHtRcrvNw+B7kHppTjv0QSxpjg2hphYwZ6ZeoCKrgskDvwI99FXyapof6S4l8rA3Lgc3DujoX0YKYSJ5882Gxz0KlvdUDbxRMfr+fBgQBZ1fflnElx3MwFhyz6mMsrkvhlceJrd3psx0uS+jCq+akAQsJjl85RJiJHjl0I5HK3OqqBoM/klvFS9wD0tABNqJj/TqsckzmcN1aGhuDjsGDoMqfYNkc+mKn0QFDbGrLrtyEqLUCAHyoxD0uE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231221)(944501327)(52105095)(93006095)(93001095)(6055026)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:AM5PR04MB2993; BCL:0; PCL:0; RULEID:; SRVR:AM5PR04MB2993; X-Forefront-PRVS: 06237E4555 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(39380400002)(376002)(396003)(346002)(189003)(199004)(106356001)(66066001)(478600001)(47776003)(6116002)(3846002)(2906002)(186003)(16526019)(26005)(68736007)(51416003)(59450400001)(76176011)(86362001)(6666003)(36756003)(43066004)(25786009)(6506007)(305945005)(386003)(7736002)(316002)(50466002)(16586007)(105586002)(39060400002)(5660300001)(97736004)(6512007)(3450700001)(956004)(8936002)(8676002)(53936002)(2616005)(11346002)(446003)(4326008)(48376002)(6486002)(81156014)(81166006)(52116002)(50226002)(476003)(486005)(486005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR04MB2993; H:otc-sw1.am.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR04MB2993; 23:wLAIn8NGWKhHFT7koGdMBVXpUN+fIh1Gcz1KM1cDh?= =?us-ascii?Q?suglOcZAAGmb9F3g8uxlHwbrk8ef/NKqkyD4GCXfqi4sOobDVKAbtV8H6oUz?= =?us-ascii?Q?SU47mvL7ls7pN97X4Tx71N3Phtp7VV2uMvjEGORClLD27b4sozn/mpARfTGh?= =?us-ascii?Q?q3jitlZX42vRfuEQUJsF74I3Z8hDgJu4+kRV4SWsiGK9KQXzXuPtESwQPbV+?= =?us-ascii?Q?VD6/CZGift13dxC2zR98dZu3smIH19t7qUihhSZAAXsCnEJFTJjJC/HPYXXo?= =?us-ascii?Q?HbiqQ/x/Hu43xKZdQNXrNq3YTVQ17LrkMDauFyqo/kdLH2HjJDBEpO8uP2qt?= =?us-ascii?Q?GCkjkeX4WZgYGO0I85cH/HiuvXviFwdcLSAJueLxT5Sg2SJJOua1NpirDDwO?= =?us-ascii?Q?BObQLklIzoS6r+shq7SPj8H4G6LOLau5yhuC3HoVqzzuYAW/2VaKT9nraSf+?= =?us-ascii?Q?DO6byDbL3EU5rc/+eA33o7yP8gT/QNM2sLdQsUIuju869oYHYJp7N3RDYYRk?= =?us-ascii?Q?0B5xgdcbitaKx0NM3affMNe00JaOQJj9Cj5RZLHWQgyk+Xc4y+0Fo27mASiE?= =?us-ascii?Q?Yw90J4jX0moPZ6t2+yZhFcsFebuy56tcvXfgP2oSs/TPXPW5zMScyogxbbcj?= =?us-ascii?Q?8ZKUamc3j+nkrx7Bgn6+tANVeZn5knsrYSvLobb5F/3unjEOfFcSP7l4g1OG?= =?us-ascii?Q?jVzksBAxSWbFKs1jimG5HfkPd1TvUauHqXQARHisaP5uadAL3HSqWrY+8tY4?= =?us-ascii?Q?cAdxaFhzXS955OM41Vw1ZpRhFNLCp4Qk42wIJMGy9o1xGEXsMJQTnek/qQL6?= =?us-ascii?Q?yjj7A2LugI1X9v3rH+tOaaCP514FZGsmjyBwhnY3wPUzc+mnSwdMRUuaGlVC?= =?us-ascii?Q?P1U4U22qcwYXKxAxGCYRVXxM9izmZcYrKsNyYYPYhQYFUNmMMcDb6AIWrmSw?= =?us-ascii?Q?IGYUb67uhVEHBPys/Vt7AI2Yo5cGSsHYeEjF2hLkt1EJLjxuiATfrZoNhdlJ?= =?us-ascii?Q?OYtxeOehdP3Umq/+flQ5L7l0McpapXGqu5YRYRdTI8a+yMKfNofcLF+VJQFw?= =?us-ascii?Q?tF5fnuUmQftfhYI/oKIGhDlBmxQe09/CIwBOHsV5yqIlDhXzA0C2IPIH78BE?= =?us-ascii?Q?ny2e+D9Q/StJC5ab2dpqXjvrSk/v8lv5Fddypgm1mMSLjh0rnSkAybICBwc3?= =?us-ascii?Q?eJGUOw88XTrMX9DPQe7SAB6POy5bLKo5dv1BAvHJnfc0fIJCsZmpKiTl8Wa1?= =?us-ascii?Q?CYkkT8r9AR+MabxwyNKcakWIs2W2CUr0Qg4/rcG?= X-Microsoft-Antispam-Message-Info: WD0vYiUYGNn2+mAlLROuVxFU8fCUh3iopb/nDBS8OJnDPVCnJ9GLD5URzMOCrCMfGBPtF+TPmUdQVYJDYwZaueNRPPmTn8thmdKskcykFs1mhI1LAZ1I8dpaRVWZHd1aeKWUIlE2rFlbSKn08iHoXIz6Kwnz6MPjxeSU+UZPd7ieage8/iJpXmRUcn4MUQLg X-Microsoft-Exchange-Diagnostics: 1; AM5PR04MB2993; 6:0Fljb7h5zakAOoe7UHhOL2zqTnKag1kgbGSQsV3d+DR53HrRPcXHJbPQRFD0C0T5xzdHdUlxKuHeBbTQ0nVEnLPqH4suVsulkT3BMTCKSIry+2/G02amdtwG4Al7x83oUYWLsmYgZBe+a4dT5guVObl897+0zeD9EVdqQn5LFGuxsIJTuvdDlRnPGBch/AzM5YZe1IwaBvcHd2DORwyEOpt1YscsQco719yw4q4QetDktj7RpGvklaSyVwxefYMZQi6dl7WAT92Fr4HXUblI4orx2FnS8oXxH5zuxRfFS2+R1dE7dl4r9Nvb98uI5fXKEwvXkyEk6y1Yt6qLWbGY8nO8XRWwTqYyyCdchIh5h3KQ9p5r5YxVI/gUFDjcYYGEYoRM3sA4iKDO20o6WvNpUp5Zud0XJcDXinr6UmiqCsuoR4z/F3AVxmZtfQNvmntXjHYbrSI+htAYv8cmyEbuEw==; 5:4OeeXCjoZhD98wzQiP+C0w7/8fZYdUQgMeL1nWnPlVfe475HtnXFUuyoKDj5h7wCxcwOj+1Y9s7PF7QlQ8Lm/uQKQxW6kwNK3Ev6z9kP0S1nySElyyGlPfxwIw/k1MoxcetyzfI9RCRLzzG3Wps19DUxfDTDni2Osf8m/LdhWl8=; 24:aQkry5f1LUgbv2ZRrESqhJB0tyiFYExuaiKB5I2CmA/lnTY7/YdnOu10M9rXLJ4diXFAA0GkaXGbVvB7ppsiwCCgTzmHG7djT2Aw/GnasG4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR04MB2993; 7:Vr9shMoCY9i0bRtrb3wOog2RZrcrwewOajDP02+XqpKl9PpN5sbgLNospbUyNoCrX2Jz8znqlkK9QkX8PTIQThG+plmua1TrNyXHE9Mup63BO6clSSvRWZL6gPfnDHJ+2aXe8CEK3wHJ3RtVBT9rLxieLsjZCtzPjazTzeK34HNOVgqZPFbLwCRSSNO8p4lsPMFm9BlhLbjrVeCQFyCdXlWDDMwsnMAZ2aQbm+NnHkze7vhp/qO6XOgfHNpnbup3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2018 19:05:58.3763 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da6638e5-42fe-4f3d-3fd5-08d5934c9d60 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR04MB2993 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180326_120615_861011_403B5906 X-CRM114-Status: GOOD ( 17.02 ) 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: , Reply-To: roy.pledge@nxp.com Cc: ruxandra.radulescu@nxp.com, arnd@arndb.de, gregkh@linuxfoundation.org, horia.geanta@nxp.com, linux-kernel@vger.kernel.org, leoyang.li@nxp.com, stuyoder@gmail.com, catalin.marinas@arm.com, Roy Pledge , laurentiu.tudor@nxp.com 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 The error path in the dpaa2_dpio_probe() function was not properly unmapping the QBMan device memory on the error path. This was also missing from the dpaa2_dpio_release() function. Also addresses a memory leak of the device private data structure. Signed-off-by: Roy Pledge --- drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 49 +++++++++++++++++++-------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c index e00f473..e7a0009 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c @@ -28,6 +28,7 @@ MODULE_DESCRIPTION("DPIO Driver"); struct dpio_priv { struct dpaa2_io *io; + struct dpaa2_io_desc desc; }; static irqreturn_t dpio_irq_handler(int irq_num, void *arg) @@ -85,7 +86,6 @@ static int register_dpio_irq_handlers(struct fsl_mc_device *dpio_dev, int cpu) static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) { struct dpio_attr dpio_attrs; - struct dpaa2_io_desc desc; struct dpio_priv *priv; int err = -ENOMEM; struct device *dev = &dpio_dev->dev; @@ -117,7 +117,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) dev_err(dev, "dpio_get_attributes() failed %d\n", err); goto err_get_attr; } - desc.qman_version = dpio_attrs.qbman_version; + priv->desc.qman_version = dpio_attrs.qbman_version; err = dpio_enable(dpio_dev->mc_io, 0, dpio_dev->mc_handle); if (err) { @@ -126,9 +126,9 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) } /* initialize DPIO descriptor */ - desc.receives_notifications = dpio_attrs.num_priorities ? 1 : 0; - desc.has_8prio = dpio_attrs.num_priorities == 8 ? 1 : 0; - desc.dpio_id = dpio_dev->obj_desc.id; + priv->desc.receives_notifications = dpio_attrs.num_priorities ? 1 : 0; + priv->desc.has_8prio = dpio_attrs.num_priorities == 8 ? 1 : 0; + priv->desc.dpio_id = dpio_dev->obj_desc.id; /* get the cpu to use for the affinity hint */ if (next_cpu == -1) @@ -139,19 +139,28 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) if (!cpu_possible(next_cpu)) { dev_err(dev, "probe failed. Number of DPIOs exceeds NR_CPUS.\n"); err = -ERANGE; - goto err_allocate_irqs; + goto err_too_many_cpu; } - desc.cpu = next_cpu; + priv->desc.cpu = next_cpu; /* * Set the CENA regs to be the cache inhibited area of the portal to * avoid coherency issues if a user migrates to another core. */ - desc.regs_cena = memremap(dpio_dev->regions[1].start, - resource_size(&dpio_dev->regions[1]), - MEMREMAP_WC); - desc.regs_cinh = ioremap(dpio_dev->regions[1].start, - resource_size(&dpio_dev->regions[1])); + priv->desc.regs_cena = memremap(dpio_dev->regions[1].start, + resource_size(&dpio_dev->regions[1]), + MEMREMAP_WC); + if (!priv->desc.regs_cena) { + dev_err(dev, "memremap failed\n"); + goto err_too_many_cpu; + } + + priv->desc.regs_cinh = ioremap(dpio_dev->regions[1].start, + resource_size(&dpio_dev->regions[1])); + if (!priv->desc.regs_cinh) { + dev_err(dev, "ioremap failed\n"); + goto err_ioremap_failed; + } err = fsl_mc_allocate_irqs(dpio_dev); if (err) { @@ -159,11 +168,11 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) goto err_allocate_irqs; } - err = register_dpio_irq_handlers(dpio_dev, desc.cpu); + err = register_dpio_irq_handlers(dpio_dev, priv->desc.cpu); if (err) goto err_register_dpio_irq; - priv->io = dpaa2_io_create(&desc); + priv->io = dpaa2_io_create(&priv->desc); if (!priv->io) { dev_err(dev, "dpaa2_io_create failed\n"); goto err_dpaa2_io_create; @@ -171,7 +180,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) dev_info(dev, "probed\n"); dev_dbg(dev, " receives_notifications = %d\n", - desc.receives_notifications); + priv->desc.receives_notifications); dpio_close(dpio_dev->mc_io, 0, dpio_dev->mc_handle); fsl_mc_portal_free(dpio_dev->mc_io); @@ -182,6 +191,10 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) err_register_dpio_irq: fsl_mc_free_irqs(dpio_dev); err_allocate_irqs: + iounmap(priv->desc.regs_cinh); +err_ioremap_failed: + memunmap(priv->desc.regs_cena); +err_too_many_cpu: dpio_disable(dpio_dev->mc_io, 0, dpio_dev->mc_handle); err_get_attr: dpio_close(dpio_dev->mc_io, 0, dpio_dev->mc_handle); @@ -189,6 +202,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) fsl_mc_portal_free(dpio_dev->mc_io); err_mcportal: dev_set_drvdata(dev, NULL); + devm_kfree(dev, priv); err_priv_alloc: return err; } @@ -230,8 +244,13 @@ static int dpaa2_dpio_remove(struct fsl_mc_device *dpio_dev) dpio_close(dpio_dev->mc_io, 0, dpio_dev->mc_handle); + iounmap(priv->desc.regs_cinh); + memunmap(priv->desc.regs_cena); + fsl_mc_portal_free(dpio_dev->mc_io); + devm_kfree(dev, priv); + dev_set_drvdata(dev, NULL); return 0;