From patchwork Mon Apr 9 00:16:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132997 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp784127ljb; Sun, 8 Apr 2018 21:13:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx48U+jPnfG0hgw0/rQL4OeisNkh01XQzIEKm9c6moL1xLrxfM598b5PoCWHlx1nKVJ8vVKus X-Received: by 2002:a17:902:a50d:: with SMTP id s13-v6mr2502564plq.228.1523247206534; Sun, 08 Apr 2018 21:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523247206; cv=none; d=google.com; s=arc-20160816; b=azjBE5vN0Y5x4wVG80+MyZnW4VKSudWgVzoby9U1kVz9vljApxvnTlVG/nvxfGymn3 uZmxrwgEh6oclEPWr0w5g+1WI8GInx5yXlWi8aVbGKcv/wYkCtTDGYcy00nqFdaxJcS3 qA8Ow3mp9Yd8DdzjL/WFTzfjIqThAIAVCwDvMKyqRD4BxRl9ogSnkjYopIy9Fy0amb3/ aSgW6D6cIU9kTesLVBeYv0+Z6b6n1W1/2F+4R7cKy/pp7BX5rh464qUBqZOPN0KXqBeh 4rnQ0DRdGG+J9U2fyX0UzX7euldAs/oRQvuFHdDrSGKwkUMfLQcwT8vbjwOGrumVPDhg O43A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=wpoR6aEFW0THcWHCqIKyaixHijPUtSOlcI7d2SQ8BFs=; b=wO9PuLUBHHGPsrraHdEV91sYO4cYKFnAk3/XzeDTPFu8VyMPI5JZkfH7Av4w/5D+RC wIZk7Fx1i/i5wXs/w7M6xDsHdcBfk+WRoXtOTavHkKCq8ksuRa5JbeRJGxWHcvBLBRbN 5v5i2DpwWzQ1cG7wNStkARK5iwUKIF+NNxhpu3gugmJ7Ib6HCyqUqubXvni8A3e8vp7W LWGqCJ7kp+CTV7lcuZc75vCCLkxT+oyuxs3aGmE2DCeW1i7I8/cg+mk0Znfyp5Ps2Dek 8c+PdpPIrQ8O7Ui5QtsON8v0F/fHXRfOj/UzEF7MMJ7Oa31vR2ORrKdRohoBslydaGQv hI9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=JgwgKLsD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r62si12274578pfe.68.2018.04.08.21.13.26; Sun, 08 Apr 2018 21:13:26 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=JgwgKLsD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753459AbeDIENW (ORCPT + 29 others); Mon, 9 Apr 2018 00:13:22 -0400 Received: from mail-cys01nam02on0097.outbound.protection.outlook.com ([104.47.37.97]:28800 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751919AbeDIAQu (ORCPT ); Sun, 8 Apr 2018 20:16:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wpoR6aEFW0THcWHCqIKyaixHijPUtSOlcI7d2SQ8BFs=; b=JgwgKLsDnozJbByi+zeLxLZm659nUieB25g43oDJayy9fen60FoSzw4/F0f2rITohIGpbzNdjKzpoqy05J2R5bdZTEUdgNgg6/f4A5AKgi+qY9eCYjLKuDqYwgRVRA5xfPascD/C6qU+8918p46R0/nd3i6lLBF3NQlbUGpUSSU= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0968.namprd21.prod.outlook.com (52.132.133.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:16:47 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:16:47 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Marek Szyprowski , Guenter Roeck , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 005/189] hwmon: (ina2xx) Fix access to uninitialized mutex Thread-Topic: [PATCH AUTOSEL for 4.15 005/189] hwmon: (ina2xx) Fix access to uninitialized mutex Thread-Index: AQHTz5gM+LNEjWCJgk+hNtVQwGKr6g== Date: Mon, 9 Apr 2018 00:16:47 +0000 Message-ID: <20180409001637.162453-5-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0968; 7:1r64KLPY4TikLiONMCmPhSmVwg5EKVZPdGpUJR8+QKEhncXpjjXqad0jT7NGdL2GEQ614veJW9qv9IH/K1MqOlcu36Sw/OD6G7mDbUlST4Wle09immVy58RRv8PyxH2rCss6IjCqmUSBIcgfofcMxMiStyIU6uN+nMIP2T85LsBSxbDrWOdYq+kH9/YKTk0ktvUfN6AG/Rru/AuM0/dfaEKsOe/Nhc78ZCzM0xPWj1AWVkDsBoyLOSOd/78kgrXA; 20:+bvBHvpVwWl/4u0WUD++g5IuZP/cAKhQKjPk7gXZQnzpuNe2ck2oa1gzwJrBkh2nBIkKUrs6t2MyJnKZEpYJgZVwLvrfqvFFJYYzeDpc2dsnGqDcVdmmoxKIOx0+A1+OE5+kNgifGFyVooRuD9K7OAM39sjVO4ffnXsNjEXy2eQ= x-ms-exchange-antispam-srfa-diagnostics: SOS; X-MS-Office365-Filtering-Correlation-Id: 52b8e0e1-2fd6-4421-1dfd-08d59daf2f1b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020); SRVR:DM5PR2101MB0968; x-ms-traffictypediagnostic: DM5PR2101MB0968: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(7411616537696); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB0968; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0968; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(346002)(39380400002)(396003)(189003)(199004)(6486002)(53936002)(107886003)(81156014)(36756003)(10290500003)(6436002)(81166006)(5660300001)(478600001)(8936002)(8676002)(6512007)(106356001)(5890100001)(105586002)(5250100002)(2900100001)(7736002)(305945005)(2501003)(10090500001)(66066001)(25786009)(476003)(3846002)(6116002)(186003)(2616005)(59450400001)(68736007)(6506007)(486006)(14454004)(575784001)(86362001)(99286004)(26005)(102836004)(22452003)(76176011)(11346002)(2906002)(316002)(3660700001)(110136005)(97736004)(86612001)(3280700002)(1076002)(4326008)(446003)(54906003)(72206003)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0968; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: uL3z+2etXrbx8xfar2naHFRKpYSihHo7iSRda+M3xgMsmRsUC4vGSaOHIFfRKIWKgKCOUl3nt+x7wcL1PPzgcO8obQ2j0bBxHPEEnZDiZBsUJ1PnpSxOl71K12hKvni+AmWWFNgrStYhZ/Y2583XfMkwcmLG0fTD2yHTS2gG2KwJ0/j2+Rqn0WFFYpiU4PzQdbykEaIZvtmlEoaFXv9CzEu6lNmUb84nWuZrz+EwF/X8YOVezAtR7LIDOpfkaSssVgVbSJWeQGG69nryv2ge+L2jJi0i4u+RZRdPz76UECklhbMLLI4MOWG8llVCwajz6Q6twK2dnDiIWN7iaGGyS0dB9GRg7O25gKyFoCCg9t7EgyydQ9qDzNETXvz9XUWh6UMWbXMFGDUOuWTO3vTYyUlTQN0fcc54rL9c3l4p5tM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52b8e0e1-2fd6-4421-1dfd-08d59daf2f1b X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:16:47.6843 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0968 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Szyprowski [ Upstream commit 0c4c5860e9983eb3da7a3d73ca987643c3ed034b ] 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 Signed-off-by: Sasha Levin --- drivers/hwmon/ina2xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.15.1 diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 62e38fa8cda2..a55823b52b2f 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -438,6 +438,7 @@ static int ina2xx_probe(struct i2c_client *client, /* set the device type */ data->config = &ina2xx_config[chip]; + 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); @@ -467,8 +468,6 @@ static int ina2xx_probe(struct i2c_client *client, return -ENODEV; } - mutex_init(&data->config_lock); - data->groups[group++] = &ina2xx_group; if (id->driver_data == ina226) data->groups[group++] = &ina226_group;