From patchwork Thu Oct 22 18:56:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 7467171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A986F9F302 for ; Thu, 22 Oct 2015 18:57:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0CAD20836 for ; Thu, 22 Oct 2015 18:57:12 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id E15CF2083A for ; Thu, 22 Oct 2015 18:57:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpL1k-00051F-Tw; Thu, 22 Oct 2015 18:55:52 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpL1h-0004sX-RI for linux-arm-kernel@lists.infradead.org; Thu, 22 Oct 2015 18:55:50 +0000 Received: by padhk11 with SMTP id hk11so93994017pad.1 for ; Thu, 22 Oct 2015 11:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ettus_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=LwwsYwX5Pket/0fvcdeQmxs/pPgge8qYTJP70txRKkM=; b=i5WcK1WCQyLcyp4nS44s42nksPRr91YrtNCRuAFcvB6jLzmh6CHAUkosse5qV/PJbV ewl6VfInbmUBRqqZqME7LnF2z/sJ8p4qDwwmQw6WSXhhee9sA0HhfNUIsLQ4wNKJnf6t Cx208zdtyrsJQ8i0saO81Fqh1dOufASh4pObId2MRosBKBoaKToTspDKpIJzWFNz+yk2 VcR+BhoMu09cXsnwuQxjM1RLM1uqrFYlJsEcYhhBh3pKnQKYhjMEyf3gNjP56BX11y8Y tZMl6us3noeZvpvgzbnEI8Kb3zVq8g0Vr4G0Df1VdVMius449V3av9P13U4L1QTvkwPx pIpQ== 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; bh=LwwsYwX5Pket/0fvcdeQmxs/pPgge8qYTJP70txRKkM=; b=l+XzFXoJ0j0wJA0qJ4aClb9nqvL57EH+G1XKZ/0u0D7ZfRoTao+QJtRVdrfIe2rryx WP//NSg9zjECD2biHonVpdk+5B3U2cU4GZ+u59UH1+zc7fEG/L8oVUSdATo+uUPo97tH Amwh+uO/1r9VzH/QNSr+29xi2S0ltaEF4ppl+tFPsxxOMme4WmJWYombwrObwA42XgCj SyjaDtBFPvAplD+e+vRsddAxcHeXMxKoLd7sMfR4qb8Hz9+QnGZAJitq448cwc5BN7UY 6u+Iw8PxWddyV7A3FLUCovKEL3SMAGSXmedPYSwWLDWuK9gME0pm9hRwrRoL5O2slp/4 FuhQ== X-Gm-Message-State: ALoCoQn/4Grozul8bXPPnTR75oKqXJO2g2LDSEaW3MfCjTCaNZeT+lJgJp03meIlVgMMUrXFyVC0 X-Received: by 10.66.217.138 with SMTP id oy10mr18839283pac.149.1445540129105; Thu, 22 Oct 2015 11:55:29 -0700 (PDT) Received: from archbook.amer.corp.natinst.com (207-114-172-147.static.twtelecom.net. [207.114.172.147]) by smtp.gmail.com with ESMTPSA id ns1sm15041329pbc.67.2015.10.22.11.55.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Oct 2015 11:55:27 -0700 (PDT) From: Moritz Fischer To: atull@opensource.altera.com Subject: [PATCH] fpga: zynq-fpga: Fix issue with drvdata being overwritten. Date: Thu, 22 Oct 2015 11:56:09 -0700 Message-Id: <1445540169-20715-1-git-send-email-moritz.fischer@ettus.com> X-Mailer: git-send-email 2.6.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151022_115549_930763_C938B1B0 X-CRM114-Status: GOOD ( 10.39 ) X-Spam-Score: -2.6 (--) 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: Moritz Fischer , gregkh@linuxfoundation.org, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, soren.brinkmann@xilinx.com, joshc@ni.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Upon registering a FPGA Manager low level driver, FPGA Manager core overwrites the platform drvdata pointer. Prior to this commit zynq-fpga falsely relied on this pointer to still be valid at remove() time. Reported-by: Alan Tull Signed-off-by: Moritz Fischer Acked-by: Alan Tull --- drivers/fpga/zynq-fpga.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c index 31db550..c2fb412 100644 --- a/drivers/fpga/zynq-fpga.c +++ b/drivers/fpga/zynq-fpga.c @@ -416,7 +416,6 @@ static int zynq_fpga_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - platform_set_drvdata(pdev, priv); priv->dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -477,10 +476,12 @@ static int zynq_fpga_probe(struct platform_device *pdev) static int zynq_fpga_remove(struct platform_device *pdev) { struct zynq_fpga_priv *priv; + struct fpga_manager *mgr; - fpga_mgr_unregister(&pdev->dev); + mgr = platform_get_drvdata(pdev); + priv = mgr->priv; - priv = platform_get_drvdata(pdev); + fpga_mgr_unregister(&pdev->dev); clk_unprepare(priv->clk);