Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp215216lqe; Thu, 4 Apr 2024 04:52:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUc0S75fjD6eMWB8zJk79JOn0Glo9fZOobPC9fXqj5sritDFXM65vFLiLl+IXUCxwn1aYVfwBzVr05QnnTAFmTBTF96q8zYy29U8DIfTg== X-Google-Smtp-Source: AGHT+IF+5V/3qxygAhFOWG/mP0FAzkyw8pbNEJDpQobe0RdgpBXps5SG7qRZj6KYUThKJszV658d X-Received: by 2002:a50:ba82:0:b0:56b:dce0:c795 with SMTP id x2-20020a50ba82000000b0056bdce0c795mr1525342ede.4.1712231548828; Thu, 04 Apr 2024 04:52:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712231548; cv=pass; d=google.com; s=arc-20160816; b=A2olhZUMo9dts7WtVNfk5Bekyq8YC/AYWfSu0Z4+9rmMYQcNz63fQUTEX2TQum0M0y tmbSxz2bzRMxmzzqCntmd+xm/Nal6BWwjDPdIcHeQ+UGXhwQEdnHc8mCOTvpj2d+yDeU t+8SvpQtWPnU6OzouBluoDoP5fev5OIYtrlhi16Ql0e+AL07vlY2IT9BsPXx4fgoN5oF xGCnc9tyVzYJpJeMWcjmAB7ErwurWd78cW+yjCrGDEqpFEAE1bNUvL/T4CoAFnNyHamU CgMUJ0BywAFaYon+UhRDi/AtYV6jgdbA29U/CnWugCc+B+0aopEqiUVVw8+j/MpuGuq5 u+sQ== ARC-Message-Signature: i=2; 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=YUJMp+5gaqHO9C+U3LihLoNrCYhYGZepqKwoI2xxkHQ=; fh=IHuuK3kvpibAd+i5U6xgH083eCSLLywM00cVOOAIuQY=; b=yMYZG4ihhRg5ZgNipvqgfPHvvSGsdJsw2NBA+00M3x5B/8C+VOOhj3hrZLg8sDb1Oe 5/nYSBW8eott8C1a0Kvj8rBqJLeiEgzLuS63aDZ3rLnYR8Sd7YlcKL/7Q62NRVcDgEzf MtTkcfzrY5djIaRR1Y8sbg/kBKshrabPphPdfQ7p7PFGOz/30GuzhqSCNTK33jEWr2n5 6NgOCdJHFCEfX9sW7Mdp1Um2xuP2ejEwDP/YIIxwkxln566zE4abR1vMwVRky9QMSO8j re53dAFJ1PhFDA8iVDrzmD7Myu9w7vaWosxKWLwtht6be6NH1rjyskb/YQqktwi15j4N uD0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ox5FpK1A; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-131324-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131324-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n28-20020a5099dc000000b0056e214d62eesi303706edb.182.2024.04.04.04.52.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 04:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131324-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=@kernel.org header.s=k20201202 header.b=Ox5FpK1A; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-131324-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131324-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 842831F2ADD4 for ; Thu, 4 Apr 2024 11:45:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF6B784FAA; Thu, 4 Apr 2024 11:45:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ox5FpK1A" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2113184D10 for ; Thu, 4 Apr 2024 11:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712231108; cv=none; b=h1/nD4gYpmwYa64tUOWwIV72NNpan/HZcnETE+PMSt2AqxR0F3AbER7w3aaAKQxtzVv1txu7RkkYM8ax/FuRF3Q8M/vWQrr+ojmDGvihb0mN/aPFRying62osINcmubknXPceNFWkKnUGYPkPNOL5/CQZ2VWnhQjZFB5wHwutSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712231108; c=relaxed/simple; bh=gv1Ocmcd5hUfsp3yAkdFPtRtCSZP9+xU7yTapbaEZQs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ep0isesOP7EwXsBtYfSP5Q0FZ2s7gOXlbBJgoj+mO8gnH3gwW5tBobJyNG5zJVViEWwRjU3hJs5sIbc2rmJoPBiJ3hQJDHUmBlUwKR2LygNGUDp3tDIvzMVacelqMm88kz5oYj5QlnSi5yrlqcThslesSnc3YlHd79n1FKKmne4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ox5FpK1A; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9F5EC433C7; Thu, 4 Apr 2024 11:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712231107; bh=gv1Ocmcd5hUfsp3yAkdFPtRtCSZP9+xU7yTapbaEZQs=; h=From:To:Cc:Subject:Date:From; b=Ox5FpK1A1fizasks/Iq6eFp655qD7PNJoT+wg1+aYw9yGUDpYJ200snt5IdeU1/8h Fnp1aj9cD/WRXU7wCIJRVccTBJLiEK8ilU198qQuzOZkKUIgrgUDD5001Ih5/aM4un UEly6LwRgSfOA3mrlAWC/y0PZBiUEHq9Z65PmWDf5rc0ksZQsJ6BZTtl4jQwE+MQUC VN3/7ApTYYBMc0lbfDadwzx5o0HjqSMAxU5FHg+4q5BeRfxLI7k//4CrYZekoPrKnI /Jw51s8Fc5oVIGGIYc3YEVZPxipvhWlGjkWbIoLX90VKci9cFvIDsHlg/0pzit/Woq x+OJBVNXe+oBg== From: Arnd Bergmann To: Andrew Morton , Palmer Dabbelt Cc: Arnd Bergmann , Christophe Leroy , Paolo Abeni , Jakub Kicinski , Charlie Jenkins , Noah Goldstein , linux-kernel@vger.kernel.org Subject: [PATCH] [v2] lib: checksum: hide unused expected_csum_ipv6_magic[] Date: Thu, 4 Apr 2024 13:44:33 +0200 Message-Id: <20240404114450.449683-1-arnd@kernel.org> 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-Transfer-Encoding: 8bit From: Arnd Bergmann When CONFIG_NET is disabled, an extra warning shows up for this unused variable: lib/checksum_kunit.c:218:18: error: 'expected_csum_ipv6_magic' defined but not used [-Werror=unused-const-variable=] Replace the #ifdef with an IS_ENABLED() check that makes the compiler's dead-code-elimination take care of the link failure. Fixes: f24a70106dc1 ("lib: checksum: Fix build with CONFIG_NET=n") Suggested-by: Christophe Leroy Signed-off-by: Arnd Bergmann --- lib/checksum_kunit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/checksum_kunit.c b/lib/checksum_kunit.c index bf70850035c7..404dba36bae3 100644 --- a/lib/checksum_kunit.c +++ b/lib/checksum_kunit.c @@ -594,13 +594,15 @@ static void test_ip_fast_csum(struct kunit *test) static void test_csum_ipv6_magic(struct kunit *test) { -#if defined(CONFIG_NET) const struct in6_addr *saddr; const struct in6_addr *daddr; unsigned int len; unsigned char proto; __wsum csum; + if (!IS_ENABLED(CONFIG_NET)) + return; + const int daddr_offset = sizeof(struct in6_addr); const int len_offset = sizeof(struct in6_addr) + sizeof(struct in6_addr); const int proto_offset = sizeof(struct in6_addr) + sizeof(struct in6_addr) + @@ -618,7 +620,6 @@ static void test_csum_ipv6_magic(struct kunit *test) CHECK_EQ(to_sum16(expected_csum_ipv6_magic[i]), csum_ipv6_magic(saddr, daddr, len, proto, csum)); } -#endif /* !CONFIG_NET */ } static struct kunit_case __refdata checksum_test_cases[] = { -- 2.39.2