From patchwork Mon Aug 8 05:52:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9266683 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 A755760839 for ; Mon, 8 Aug 2016 05:55:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97C2B26E69 for ; Mon, 8 Aug 2016 05:55:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C10627813; Mon, 8 Aug 2016 05:55:37 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3BD6826E69 for ; Mon, 8 Aug 2016 05:55:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bWdVR-0000hh-E8; Mon, 08 Aug 2016 05:53:45 +0000 Received: from mail-pf0-x229.google.com ([2607:f8b0:400e:c00::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bWdVA-0000cV-GA for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2016 05:53:29 +0000 Received: by mail-pf0-x229.google.com with SMTP id y134so115700688pfg.0 for ; Sun, 07 Aug 2016 22:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S5ZXfNs8wmIiQ1fVOidD4ZjViaAV2eKXd0tmX50AByA=; b=E39zyQMOyKe0REbHQ3BDINq+nf6tNKjead4HSXSjwY6AoDdQzsZOChX/nyuDofsraA 9pgVTrrLLI1zXeG0i0bUiQWvovh6uo9x94MhHlexsUVsU1yvwFZ/Pb0wmsXL5ei7Kyq9 d6ujBJ05PB5YOYSFgIwetmaUpGfJgMRecZEQA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=S5ZXfNs8wmIiQ1fVOidD4ZjViaAV2eKXd0tmX50AByA=; b=Pcin6YNJbpOzMRGlrST0Fea+C0f+8c/XiWytExUTz+x3UrRBKuDczFEsxMbCPSlaiD xUyDVT7TsHfSr1zFQfyJeDnlPYgFWti47vLooFZfeXeqGtB3BiBYCtxk1N4VKYDwe8xF spcVgPrtEDGHnVD1v4yxOzGG7qcrbnoO//3gyPGippmGOOEtUPQIwxdvvbAx1pm9E+LK gidSZt/xyIwHXuYxVpigYoQXxxGc+cV4MdwMbkkGpGMpGu271A7YNy38CZpdEJTx5YlX XWOkBKyxAhHF9q4jtZu6AqMq0RKDXgEsgnaGFL3cBpWJpyLCVoeapbrbQpu5NxvroRVC 4Qdg== X-Gm-Message-State: AEkooutslBCDqEQ+4HPVmT0db8fsX8F/ln2MxIhYgt4EzgNtxPHYFNkzPifMCiNAZdwK/I3K X-Received: by 10.98.72.28 with SMTP id v28mr158905610pfa.139.1470635587412; Sun, 07 Aug 2016 22:53:07 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.ban.broadcom.com ([202.140.56.34]) by smtp.gmail.com with ESMTPSA id u72sm44404402pfa.31.2016.08.07.22.52.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Aug 2016 22:53:06 -0700 (PDT) From: Anup Patel To: Greg Kroah-Hartman , Jonathan Corbet Subject: [PATCH RESEND v2 1/8] uio: fix dmem_region_start computation Date: Mon, 8 Aug 2016 11:22:30 +0530 Message-Id: <1470635557-13416-2-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470635557-13416-1-git-send-email-anup.patel@broadcom.com> References: <1470635557-13416-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160807_225328_626399_56E0E154 X-CRM114-Status: GOOD ( 12.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Anup Patel , Scott Branden , linux-doc@vger.kernel.org, Ray Jui , Russell King - ARM Linux , linux-stable , linux-kernel@vger.kernel.org, Rob Herring , bcm-kernel-feedback-list@broadcom.com, Ankit Jindal , linux-arm-kernel@lists.infradead.org, Jan Viktorin MIME-Version: 1.0 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: Jan Viktorin The variable i contains a total number of resources (including IORESOURCE_IRQ). However, we want the dmem_region_start to point after the last resource of type IORESOURCE_MEM. The original behaviour leads (very likely) to skipping several UIO mapping regions and makes them useless. Fix this by computing dmem_region_start from the uiomem which points to the last used UIO mapping. Fixes: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation") Signed-off-by: Jan Viktorin Signed-off-by: Anup Patel Cc: linux-stable --- drivers/uio/uio_dmem_genirq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index 915facb..e1134a4 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -229,7 +229,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) ++uiomem; } - priv->dmem_region_start = i; + priv->dmem_region_start = uiomem - &uioinfo->mem[0]; priv->num_dmem_regions = pdata->num_dynamic_regions; for (i = 0; i < pdata->num_dynamic_regions; ++i) {