Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1943138ybv; Fri, 14 Feb 2020 08:37:29 -0800 (PST) X-Google-Smtp-Source: APXvYqyBivVNZzhdNlKoULVbZHSCX08PqeR8wtIMVz0rgKsWO+aBW7u34PJvshAqv6MjZAoolT0k X-Received: by 2002:a9d:62d8:: with SMTP id z24mr2883721otk.362.1581698249793; Fri, 14 Feb 2020 08:37:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698249; cv=none; d=google.com; s=arc-20160816; b=ocxiAh1BQe7Vv7ib+RWFy8gsIF6gyTBAX6ci5/qDGHp+Q9YFAIDUUFFr41FV+QZi1y dyJ3cnKsrHeOYKIRnrvwQdlmfDDGuuoZz43f1zOPjGxvOy4hHxqCgZnJ8p0y+3GLt3iI rmeTyA8iojOEXuCmzC1YaaoF5tYD/Ngm6Pe/jkgu9FD6zFE7mHW76+ZFk1mMUr2gFqgk Ei7igfpP83Sy6gK1mOZnGEqPAYdHphRMcBEla6q8k6z3ytLKcVdDhUSRnI8JZwNYD54m sul6wurw/PcctvKgx01F3YEKqw3QKK9u6lJUt3tZeEkxJ/U9TK32EbwK1Qk8MsYiZDR0 Wh3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yCtnbcoo/l/eSmGl8uKl9amDb23YrVM9mMjKerjtEvQ=; b=hruH+dIpdXESzNRaALrbYghoPmmybgCtsvthMAfb1r8yXnveBDd1ou0gEbTYUV1uqC uv/mzl5VnBudVAa1hC0z7q0gcl4UkWcsDY9/oMhWe9TZrpzO9izv6ps+7oABzQ3a3rCV PGRHjBEWX7yyAzV+GZwL8+1vRaZoGeYu+IGMEifS6rilVRE22u1ETiGVR6TTmSEDsPEl uYamwaDoVazt4LpTqgydJglBfCsazPA0FXJavT2s59oVjljvDALIOBnkkQ6maPl3Lvzp L8UzKQHugHWUxKvmqzeWpSV3+rJCDU79doQe6zIKJAE8W7x+f2EgKBPOtjKp8TMUz15I GIuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RPj+p9lH; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si3122634otk.179.2020.02.14.08.37.17; Fri, 14 Feb 2020 08:37:29 -0800 (PST) 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=@kernel.org header.s=default header.b=RPj+p9lH; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393722AbgBNQgk (ORCPT + 99 others); Fri, 14 Feb 2020 11:36:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:60968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405835AbgBNQYO (ORCPT ); Fri, 14 Feb 2020 11:24:14 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6009024797; Fri, 14 Feb 2020 16:24:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697454; bh=EvBleNZ5qR3F6cqPeTjbeYqOuB2YOs2UqbF/r7WHfj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPj+p9lHvJz0ULON82hpLapMRbwSIZkewsA/y996Ut/DRvtI9RG2rcSdSy36OU8zL ieC7NppnkgN2nRtHMlC9MClV9sCQYcCLaVxdTNMKYvorPH90VdvBOszdfXaleTn/+M 7LonBOLLcb8PAmJ1zq/F6q1Jk12063i+EjpSFnGs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andrei Otcheretianski , Luca Coelho , Kalle Valo , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 137/141] iwlwifi: mvm: Fix thermal zone registration Date: Fri, 14 Feb 2020 11:21:17 -0500 Message-Id: <20200214162122.19794-137-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrei Otcheretianski [ Upstream commit baa6cf8450b72dcab11f37c47efce7c5b9b8ad0f ] Use a unique name when registering a thermal zone. Otherwise, with multiple NICS, we hit the following warning during the unregistration. WARNING: CPU: 2 PID: 3525 at fs/sysfs/group.c:255 RIP: 0010:sysfs_remove_group+0x80/0x90 Call Trace: dpm_sysfs_remove+0x57/0x60 device_del+0x5a/0x350 ? sscanf+0x4e/0x70 device_unregister+0x1a/0x60 hwmon_device_unregister+0x4a/0xa0 thermal_remove_hwmon_sysfs+0x175/0x1d0 thermal_zone_device_unregister+0x188/0x1e0 iwl_mvm_thermal_exit+0xe7/0x100 [iwlmvm] iwl_op_mode_mvm_stop+0x27/0x180 [iwlmvm] _iwl_op_mode_stop.isra.3+0x2b/0x50 [iwlwifi] iwl_opmode_deregister+0x90/0xa0 [iwlwifi] __exit_compat+0x10/0x2c7 [iwlmvm] __x64_sys_delete_module+0x13f/0x270 do_syscall_64+0x5a/0x110 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Signed-off-by: Andrei Otcheretianski Signed-off-by: Luca Coelho Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c index c5203568a47ac..f0f205c3aadb7 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -736,7 +736,8 @@ static struct thermal_zone_device_ops tzone_ops = { static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm) { int i; - char name[] = "iwlwifi"; + char name[16]; + static atomic_t counter = ATOMIC_INIT(0); if (!iwl_mvm_is_tt_in_fw(mvm)) { mvm->tz_device.tzone = NULL; @@ -746,6 +747,7 @@ static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm) BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH); + sprintf(name, "iwlwifi_%u", atomic_inc_return(&counter) & 0xFF); mvm->tz_device.tzone = thermal_zone_device_register(name, IWL_MAX_DTS_TRIPS, IWL_WRITABLE_TRIPS_MSK, -- 2.20.1