Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933326AbdIHNXn (ORCPT ); Fri, 8 Sep 2017 09:23:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36486 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933277AbdIHNXl (ORCPT ); Fri, 8 Sep 2017 09:23:41 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Abbott , Moritz Fischer , Alan Tull Subject: [PATCH 4.12 21/43] fpga: altera-hps2fpga: fix multiple init of l3_remap_lock Date: Fri, 8 Sep 2017 15:19:09 +0200 Message-Id: <20170908131827.340240240@linuxfoundation.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170908131826.555428826@linuxfoundation.org> References: <20170908131826.555428826@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1455 Lines: 43 4.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ian Abbott commit 4ae2bd4b3ada3dfd80ca8110b4f567752966ca1e upstream. 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") Signed-off-by: Ian Abbott Reviewed-By: Moritz Fischer Signed-off-by: Alan Tull Signed-off-by: Greg Kroah-Hartman --- drivers/fpga/altera-hps2fpga.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/fpga/altera-hps2fpga.c +++ b/drivers/fpga/altera-hps2fpga.c @@ -66,7 +66,7 @@ static int alt_hps2fpga_enable_show(stru /* 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 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);