Received: by 10.192.165.156 with SMTP id m28csp239596imm; Tue, 17 Apr 2018 09:19:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx490t3J1ZS+9DcYGCdPawqPBYNxbB/6cPn7IoGGgs8tYd22sHNwu/nvDZYRnAQO435Q8FM28 X-Received: by 10.99.97.150 with SMTP id v144mr2345585pgb.264.1523981985706; Tue, 17 Apr 2018 09:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523981985; cv=none; d=google.com; s=arc-20160816; b=EAoOrAmqmonuhMlLWwNqDr08L5mdDimdLLovod1w0nVSx7CWQez36H1m9DZhuBSFVL ESiTZKWu843lWmhYyziVopfsWCjXGahvAOn3KpBA7wKwVnUUKFK6fnEmTmsAytmR5xmE B9wGTd5oLKAfSMB1NGab2WRif4P0m3aD8Y/WweKwSWnmEWSVUh5qMZk7/bI0LygxjqzR Ea/lyK/XD8rPVbsMwq6YFiqt7f/R+8P6GFMm3JQYoBpPkATum96vLpk8ayjgGiaVqGP4 VfWcnxUIu4wvFwNADpjn4TVBEe4MvtOMqAF52zlmDcZwVfElyTJtpMt0B1cxmdq5a8TJ YOag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=jON3sulnWoxrWzWmXB+Wn7F2oq9S4NqvaTiz+Z4XYo8=; b=GXEqmbdI0vdSOXFVfhI63YD63FFZPi847szAYvdlJH9DmYzG1XIpuBdY9/OC8ttocj t903l3HWhTQntzCVni/TVmXHytlBw0RkJZhPrzAx9nCuWfo8L7LnX9pzXtTcsyiCA+bR CYJ3RY6pXovfYRACu2UNwclJrFiYM0EKdt6ibXayFI/ia2KbLWPLEzHrpGYXKY8q9aZa Ad58jBAccu6AZdvW1IfM+QlnCzshyTZgSjAj7w6B4wQvNkFhmrEIS+riS4ZRL8EYhTm8 nXGjcn/iVd5Ahvu3inlmX2tuasEe8D3S8NXgUco6pV14LYa2f03F+6Lzpb5Xr98dyQ7+ 08Ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si11972748pgc.241.2018.04.17.09.19.31; Tue, 17 Apr 2018 09:19:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755895AbeDQQKj (ORCPT + 99 others); Tue, 17 Apr 2018 12:10:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36464 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755875AbeDQQKh (ORCPT ); Tue, 17 Apr 2018 12:10:37 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A71B3D67; Tue, 17 Apr 2018 16:10:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Guenter Roeck Subject: [PATCH 4.9 61/66] hwmon: (ina2xx) Fix access to uninitialized mutex Date: Tue, 17 Apr 2018 17:59:34 +0200 Message-Id: <20180417155648.514470317@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155645.868055442@linuxfoundation.org> References: <20180417155645.868055442@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marek Szyprowski commit 0c4c5860e9983eb3da7a3d73ca987643c3ed034b upstream. Initialize data->config_lock mutex before it is used by the driver code. This fixes following warning on Odroid XU3 boards: INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 5 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc7-next-20180115-00001-gb75575dee3f2 #107 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x90/0xc8) [] (dump_stack) from [] (register_lock_class+0x1c0/0x59c) [] (register_lock_class) from [] (__lock_acquire+0x78/0x1850) [] (__lock_acquire) from [] (lock_acquire+0xc8/0x2b8) [] (lock_acquire) from [] (__mutex_lock+0x60/0xa0c) [] (__mutex_lock) from [] (mutex_lock_nested+0x1c/0x24) [] (mutex_lock_nested) from [] (ina2xx_set_shunt+0x70/0xb0) [] (ina2xx_set_shunt) from [] (ina2xx_probe+0x88/0x1b0) [] (ina2xx_probe) from [] (i2c_device_probe+0x1e0/0x2d0) [] (i2c_device_probe) from [] (driver_probe_device+0x2b8/0x4a0) [] (driver_probe_device) from [] (__driver_attach+0xfc/0x120) [] (__driver_attach) from [] (bus_for_each_dev+0x58/0x7c) [] (bus_for_each_dev) from [] (bus_add_driver+0x174/0x250) [] (bus_add_driver) from [] (driver_register+0x78/0xf4) [] (driver_register) from [] (i2c_register_driver+0x38/0xa8) [] (i2c_register_driver) from [] (do_one_initcall+0x48/0x18c) [] (do_one_initcall) from [] (kernel_init_freeable+0x110/0x1d4) [] (kernel_init_freeable) from [] (kernel_init+0x8/0x114) [] (kernel_init) from [] (ret_from_fork+0x14/0x20) Fixes: 5d389b125186 ("hwmon: (ina2xx) Make calibration register value fixed") Signed-off-by: Marek Szyprowski Signed-off-by: Guenter Roeck [backport to v4.4.y/v4.9.y: context changes] Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/ina2xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -447,6 +447,7 @@ static int ina2xx_probe(struct i2c_clien /* set the device type */ data->config = &ina2xx_config[id->driver_data]; + mutex_init(&data->config_lock); if (of_property_read_u32(dev->of_node, "shunt-resistor", &val) < 0) { struct ina2xx_platform_data *pdata = dev_get_platdata(dev); @@ -473,8 +474,6 @@ static int ina2xx_probe(struct i2c_clien return -ENODEV; } - mutex_init(&data->config_lock); - data->groups[group++] = &ina2xx_group; if (id->driver_data == ina226) data->groups[group++] = &ina226_group;