From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp83.ord1c.emailsrvr.com ([108.166.43.83]:50626 "EHLO smtp83.ord1c.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbdF0P0q (ORCPT ); Tue, 27 Jun 2017 11:26:46 -0400 From: Ian Abbott To: linux-fpga@vger.kernel.org Cc: Alan Tull , Moritz Fischer , Ian Abbott , "# 4 . 10+" Subject: [PATCH] fpga: altera-hps2fpga: fix multiple init of l3_remap_lock Date: Tue, 27 Jun 2017 16:18:42 +0100 Message-Id: <20170627151842.15955-1-abbotti@mev.co.uk> Sender: stable-owner@vger.kernel.org List-ID: The global spinlock `l3_remap_lock` is reinitialized every time the "probe" function `alt_fpga_bridge_probe()` is called. It should only be initialized once. Use `DEFINE_SPINLOCK()` to initialize it statically. Fixes: e5f8efa5c8bf ("ARM: socfpga: fpga bridge driver support") Cc: # 4.10+ Signed-off-by: Ian Abbott --- drivers/fpga/altera-hps2fpga.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/fpga/altera-hps2fpga.c b/drivers/fpga/altera-hps2fpga.c index 3066b805f2d0..08c0ecb7d109 100644 --- a/drivers/fpga/altera-hps2fpga.c +++ b/drivers/fpga/altera-hps2fpga.c @@ -66,7 +66,7 @@ static int alt_hps2fpga_enable_show(struct fpga_bridge *bridge) /* The L3 REMAP register is write only, so keep a cached value. */ static unsigned int l3_remap_shadow; -static spinlock_t l3_remap_lock; +static DEFINE_SPINLOCK(l3_remap_lock); static int _alt_hps2fpga_enable_set(struct altera_hps2fpga_data *priv, bool enable) @@ -171,8 +171,6 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev) return -EBUSY; } - spin_lock_init(&l3_remap_lock); - if (!of_property_read_u32(dev->of_node, "bridge-enable", &enable)) { if (enable > 1) { dev_warn(dev, "invalid bridge-enable %u > 1\n", enable); -- 2.11.0