]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
fpga: altera-hps2fpga: fix multiple init of l3_remap_lock
authorIan Abbott <abbotti@mev.co.uk>
Wed, 2 Aug 2017 02:20:54 +0000 (21:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Aug 2017 21:27:55 +0000 (14:27 -0700)
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: <stable@vger.kernel.org> # 4.10+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-By: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Alan Tull <atull@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/fpga/altera-hps2fpga.c

index e6c948b31474392866554d1b3efe87c1c72ed037..406d2f10741f52ee665efc74492c2209bc98159b 100644 (file)
@@ -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)
@@ -177,8 +177,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);