Received: by 10.213.65.68 with SMTP id h4csp1669178imn; Mon, 26 Mar 2018 12:07:40 -0700 (PDT) X-Google-Smtp-Source: AG47ELuw1YjmiMSCdn93L6mfoWGjVSeoHruZUGDOyk5e0pJDaga92ohttzFmYd+ZfrUTByw3qVMe X-Received: by 2002:a17:902:2e43:: with SMTP id q61-v6mr41181684plb.404.1522091260792; Mon, 26 Mar 2018 12:07:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522091260; cv=none; d=google.com; s=arc-20160816; b=UfkvadD7obTLmZ9c/jvqIWc1rpUMAZvFq/msEORmiycVcuzPaYQaUfKJfUpULsBpwI PCll/0fU83IpcJf/2zeSqnqZ3idsCBdmB2YVr32PdRpFUzYdXfL9se6OTT5j9POvyBRJ 3pzMtCceFB8VL4N8EoY8HDc8f6wLlguURcIhpYArRmMnmPrX5IpUCKl+X/dRoQgGduqW wwYoj92jgSobwN4Xi6e0py0sO1QLmW8PsTleTXwUe67VeQH7Qw9opGBZRbYo1Z1nb56r 8SDaNdraOlZGHNve2MtPf9SwY5cLptpsb1AGm5Yf4OpZjpevQ1jwRNGn5r5SCuL3qujq JdsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=kwjCaHOrkX80MOEepBFVU8ZqTyysWXQyL7Y/xcB7qts=; b=yBStshtMqo8FGDEpMIS34zj4HQjh30omZar6/kxJmon9bHSwn0MXTgKUsDn2quKooQ tUhy1a/geHFMppyVbWRd1Ceuaf2ur2dYS+pCTJgHlNRP4dc++vgHJLN6zdrvsm3S1Z49 U8N7YKd0oZPIIkrW45J28FmDormecAnWQqq+0frwIkZo31RHXQIdnKvInlIvdM0BSws1 y7qIGWH3dwqn6y3CHRvwUUjWcVR+ChsUeD+DMQrKObh2KQjufxF57UJsZnAxafUg81XR t5cG7yv+x2VKxJKnAOlFP/e9TLm8ZzmuwPb+0Y+7S35vuFJGY7wkpPzaFf6KY1YT/dOE FkZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=eb3eWdZX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i81si3993450pfd.261.2018.03.26.12.07.26; Mon, 26 Mar 2018 12:07:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=eb3eWdZX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752273AbeCZTG1 (ORCPT + 99 others); Mon, 26 Mar 2018 15:06:27 -0400 Received: from mail-db5eur01on0059.outbound.protection.outlook.com ([104.47.2.59]:64147 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751109AbeCZTGD (ORCPT ); Mon, 26 Mar 2018 15:06:03 -0400 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 Cc: linux-kernel@vger.kernel.org, ruxandra.radulescu@nxp.com, arnd@arndb.de, gregkh@linuxfoundation.org, leoyang.li@nxp.com, laurentiu.tudor@nxp.com, stuyoder@gmail.com, catalin.marinas@arm.com, horia.geanta@nxp.com, Roy Pledge 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> Reply-to: roy.pledge@nxp.com MIME-Version: 1.0 Content-Type: text/plain 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+?= =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NoCrX2Jz8znqlkK9QkX8PTIQThG+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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.7.4