Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fpga: altera-hps2fpga: fix multiple init of l3_remap_lock

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>

authored by

Ian Abbott and committed by
Greg Kroah-Hartman
4ae2bd4b 26ffca5e

+1 -3
+1 -3
drivers/fpga/altera-hps2fpga.c
··· 66 66 67 67 /* The L3 REMAP register is write only, so keep a cached value. */ 68 68 static unsigned int l3_remap_shadow; 69 - static spinlock_t l3_remap_lock; 69 + static DEFINE_SPINLOCK(l3_remap_lock); 70 70 71 71 static int _alt_hps2fpga_enable_set(struct altera_hps2fpga_data *priv, 72 72 bool enable) ··· 176 176 dev_err(dev, "could not enable clock\n"); 177 177 return -EBUSY; 178 178 } 179 - 180 - spin_lock_init(&l3_remap_lock); 181 179 182 180 if (!of_property_read_u32(dev->of_node, "bridge-enable", &enable)) { 183 181 if (enable > 1) {