Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp755951rdb; Sat, 6 Jan 2024 07:47:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFW4JEphtrf+YQv8cTqjKSxOa7svs/jpk1s5mDulq/hXSbOTo6PmQ2/U8XphluyE/5P4UYY X-Received: by 2002:a50:c30a:0:b0:557:416b:e99b with SMTP id a10-20020a50c30a000000b00557416be99bmr511255edb.37.1704556078365; Sat, 06 Jan 2024 07:47:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704556078; cv=none; d=google.com; s=arc-20160816; b=wUJ/5YZV5Q2dcLqVApuD90mJ/d1PN6DV3CWKOvjYdN7zvAmHjoB8tQ1M2QHiiCyvxR M5tgsLi6ZX6b5bk/JaiLDgeVhSLyOc+ScZg8tin/NqWraxGirxpVXXEjmiesuu6LswkV frdWRyavqmY3WhAj0oTfqAU9+44gvWbT2RxMrV1LdciPy0NLYi8Mj870EJ8LafEqkdzM Lu0br3c2HyVeuFOcQ1Q2Qn51xEtZErk/5I+/yy+glCa6aEEW3Is6z4PmKqszC581xxul xf61A+7pWpCmRJafDV/EuSBaIgmGTBzbXuRBjkY45i0Qy7HImtXwEhb3RBRTjFEVD9E7 vg7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=bKMLLD2ZxyA0kUaU9sIopyxyu3bVgkbt2roLK+GW/Zc=; fh=+gYxkM+4oGNZK/3hTC0qQfOeLhcMK493vPm49hu5+OE=; b=UxMtav+kz3hraVe/ev1kJqwT36djCAObIXe/Zsj7wlHJ+kTA2Luuhb9vll4yMa9Rnn sxNfC2O2IpwB6HUmVQ+ogTMVOeb1eK4YJsME1wF4ECa76r0QDXcsjP+n8FnaHSHzOk3z ZbXvGwULU/1gyE+odvY345pfA2/A69hWxe1DCAuPU/YslPbxS3/uLlFQL82W1jGd9LxQ kXF7Gvb2j4SkkocdeW0Uw2PHyq0W8j7koeWN5LqJCDlmJKNn8P/WXOQIghpKnV3ES29f 9xbSitcCYnEpNUoWhtagnWUeyxOAyM7Pl4XVo0FHtsApXPzzwpWvvSjgsjrjzCfQmRCq uMCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HTW3Fo9K; spf=pass (google.com: domain of linux-kernel+bounces-18631-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id de8-20020a056402308800b005548e0ac193si1647179edb.137.2024.01.06.07.47.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 07:47:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18631-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HTW3Fo9K; spf=pass (google.com: domain of linux-kernel+bounces-18631-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1D2881F236A9 for ; Sat, 6 Jan 2024 15:47:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E14808493; Sat, 6 Jan 2024 15:47:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HTW3Fo9K" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A52BE79FE; Sat, 6 Jan 2024 15:47:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-3368d1c7b23so526429f8f.0; Sat, 06 Jan 2024 07:47:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704556062; x=1705160862; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bKMLLD2ZxyA0kUaU9sIopyxyu3bVgkbt2roLK+GW/Zc=; b=HTW3Fo9KieSGr41owv+U5S/YF3euDRVkKkrZO6I/7uUKRj7IE7Lxp7vdwzWhXoWS5H apj6FO9RzghVMarBiXplIuPMvuC23V785JBtgJIGf/2Shvrop2A8lSXCc7VggTs6Mvhs yuK4dsjHW0t7BoOjrtWbICwGZUB/ziiEr3VQ7mCtwa8imR7dJGqB3jk4A6M7DQkvA8Nf AKs4QlkxSCc/o4cOx8smSILwfcoxKMouG2JWkGzo2wseLwYcnz17B+2P2qIAANpMEcjR up32mgpggxvkjB8pGdAtiwMG+2qFJscnQOfM0h4ZS9cL2f4ywalLx3Cvu6Wln6+MKjBq Qg+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704556062; x=1705160862; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bKMLLD2ZxyA0kUaU9sIopyxyu3bVgkbt2roLK+GW/Zc=; b=ezzs2y7NMDqqjw1RsMaQ6aGzCy1iWnayYi6t4/rB+/9LVMNumJwW5CKmxq+OGMw7mk Dxcz/88T+o2HrS8rhDBkxZjeli3Y4FRyNinlRBNtd6LXoUUXDDiUqf2AerQhWmoq/6Wi OJHjDINbt/Rn9ictm6E1DgPkPCNL7rIuxgcjC54a40AYtHAyg/hSU8abgOB78BwIg4M+ njaEfuwwjcgLlAnCLEpLyDNUf7InYurOtpeIsWqY6Q3F3Ztjk+Knm+kz9zyyi4jOvw0/ axvqvCNbCpcbttJGIVjkCEJMDtoJiSwLiXgk47WWm1IdoQYRdw+gpt425xSroM3WEMuo IpdA== X-Gm-Message-State: AOJu0YwqnPbJYwMtGwfdJUeWWqalFjFV9OxGOHloWiR7bz9XfQ4lJl1x ZyzRO/8AJ1OWoLzmJ2m4nXk= X-Received: by 2002:a05:6000:1971:b0:336:873b:6b21 with SMTP id da17-20020a056000197100b00336873b6b21mr629967wrb.33.1704556061797; Sat, 06 Jan 2024 07:47:41 -0800 (PST) Received: from localhost (cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net. [80.193.200.194]) by smtp.gmail.com with ESMTPSA id j1-20020adfe501000000b0033686e8f02dsm3585831wrm.45.2024.01.06.07.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 07:47:41 -0800 (PST) From: Colin Ian King To: Henrique de Moraes Holschuh , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] platform/x86: thinkpad_acpi: remove redundant assignment to variable i Date: Sat, 6 Jan 2024 15:47:40 +0000 Message-Id: <20240106154740.55202-1-colin.i.king@gmail.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit The variable i is being initialized with the value 0 that is never read, it is being re-assigned 0 again in a for-loop statement later on. The initialization is redundant and can be removed. The initialization of variable n can also be deferred after the sanity check on pointer n and the declaration of all the int variables can be combined as a final code clear-up. Cleans up clang scan build warning: warning: Value stored to 'i' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King --- drivers/platform/x86/thinkpad_acpi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index c4895e9bc714..7bf91cfd3e51 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -6208,17 +6208,15 @@ static int thermal_get_sensor(int idx, s32 *value) static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s) { - int res, i; - int n; - - n = 8; - i = 0; + int res, i, n; if (!s) return -EINVAL; if (thermal_read_mode == TPACPI_THERMAL_TPEC_16) n = 16; + else + n = 8; for (i = 0 ; i < n; i++) { res = thermal_get_sensor(i, &s->temp[i]); -- 2.39.2