Received: by 10.192.165.148 with SMTP id m20csp2475756imm; Sun, 22 Apr 2018 07:50:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+T51AaLTmghqi4HxfH1ONH+AmpruMW7wWDD1Uvr23/xIWhttLBkEurwS25RqUXMJA58yCt X-Received: by 10.99.122.67 with SMTP id j3mr14334845pgn.172.1524408610944; Sun, 22 Apr 2018 07:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408610; cv=none; d=google.com; s=arc-20160816; b=H8VMjqZimaC1CljU/i0m9JpGF7kYjQJi/0iZCxi3Wdv6bY47kJ88aSe+Dpak4P+lUw S70yFtkkIJf6mAqH3lA1xpCqmrblup05c7dKCD6+ek2jKSV6Qj3Fic3sc7CL8p7yGyVD wg6UepF987nMpEnxqCJikOovlTr0ZYRG3UP8xPNLj4j1rrbVehS55NGWtkUQrAL5CG9u Focx8ZxQKtyC5BwreKYw2WVplHaBr/QfkSFhOfjDHTZgl2Wt4PmrhhFO2PHKD3TYWJOu P03EiragP3vZ7hKx5rZtbUyLoHQd/OSSpkg67iXPz4ZS7L1rCvJlDstAwKZNMqOAEq8l wj6g== 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=ZS1RCPbVLINNSHjSiEqp/D54OyDN//gtbURaTlivmxM=; b=QkqzONcD4Ez1sycTVaJUbBzvW7omVUPaGT0/2qf+i9YGjq3hmQW8QXfXVNEHN8uZIW 7XDfm5Ipm8zMm71MeZc6hHVEifqoLJzkkAdshVtTebAVp0NUSL2ee3naLIf3BB9PnOn6 Oe04CCRG4ckKlQbmurppqkb1+3SxDqffA4xhIOXoGXQqT9Imx5NEiKllVxacIer5VvMU u9RYmDTc1gUxf5I1oBQwlCWhfUa7CxKY86aLeUljTP7OZK9ZUcR+0p/n0yMgGnemx/be dX4VZ7oibzjUf+DL0DwYlU/9xb0I1v5+ZaecckWGvvjdF+NSP2ToO61XsswZs/Bbzsvm qAAg== 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 e6si9184028pff.205.2018.04.22.07.49.57; Sun, 22 Apr 2018 07:50:10 -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 S932189AbeDVOPw (ORCPT + 99 others); Sun, 22 Apr 2018 10:15:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56966 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757003AbeDVOPo (ORCPT ); Sun, 22 Apr 2018 10:15:44 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6C44DBA0; Sun, 22 Apr 2018 14:15:43 +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.4 15/97] hwmon: (ina2xx) Fix access to uninitialized mutex Date: Sun, 22 Apr 2018 15:52:53 +0200 Message-Id: <20180422135305.472721520@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@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.4-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;