From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (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 1459630DD21 for ; Fri, 14 Nov 2025 23:32:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763163134; cv=none; b=MBFcqfhHKm51s64bxbPeNiMCKIWp3lDjRj4ReekmXgoyb/fjKSalqhKKXW6IRuMK20SFEv3jkjDdwOLMXxCTJ0m4XkzEQNeM0SlRBIK0yMizBWcbshH1cqvXd/oDh4oWKY5dpP0rfAcwdExKFiDChl/9pFHiOvo7YsgN0yI3YQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763163134; c=relaxed/simple; bh=HENP1qS1Qs4R+2HtLgkw3WFwXOLqiLuX/SmK5m9/aUM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Xn21dgQrtf2qvefmOjHrB9zsx1pXCBf612DiEUmjS1I5DUkFEpp7DFx2fxOUJ3kcdq/X+aJxwzARLDtz7lGT8OcQv+h87CXhwz2opaSa3MC/gMykAKpnBwRCBPBHQvbOsP3xUycLXg1KmenX2K2QAy1EJWeUMSDv2oQNdRqmE0Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ynaffit.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=g+4kK21u; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ynaffit.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g+4kK21u" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-297f587dc2eso35635655ad.2 for ; Fri, 14 Nov 2025 15:32:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763163132; x=1763767932; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=IKaGd02bjwpFvhoNqxBNk/pXwlNOsPoawHj0lrGbTBg=; b=g+4kK21utcReuhH4oJirpc3IDyg0p5ElPukRLr5QP9FMMJ0aHPywTc6SUZbQNGa9vM L2a+cqywPtcLi7tHMI5dkvSIlTfUBVGbFbf06q7J+KXoIr0bX9upgLB52UV7LvDN7QZh jPCKPJTo47S4GzhjGh5F2ub/M+VhVdseFzlHv7m5cNDRfnxSs67yCL20qusLf+39Jamf dkNUvpeUPgIfPvokst8NVJJa9OQwhIJWqMPsapW7OdUDDeqnENgKf4BbsdAKZrul7Eqp 0nAtPbLTUpfiqFdHMTqdpbAAhVVQFdQ4Z/BfmlI0p5oueS2wyEowt4vSReGMWpz3/PZs GVog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763163132; x=1763767932; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IKaGd02bjwpFvhoNqxBNk/pXwlNOsPoawHj0lrGbTBg=; b=fbmmHT9iafHgRDDxokUqP/nVE3q1vm0OzfobFXxLBHeOgW8BmZGDVlsTe05r8qYKda GnEiWrxZUwnO+gHxykyhwcJ5iDO8dAY+NFKg/A34ZTTkeZCp22DJUm8BX22M1SS4EVp4 plf0GBEQ1pF4QB06G6IfgOWO6f3snWY6duIKptOyKG2grkzBQvpz8iNrQlKWV1cqbM1c pbSxgvCFMPaEAS7PXWWQptfq/QeOiy3pOOGS27VScuRER48NdSijZleBjoa3SZk2XtSa VHvyNlnGLF67t+g1Q0VCazD0aOGBadNQRMTMUXyxBGXacU86aZo2RaKD5hpIe9FyT/Ci A5vg== X-Gm-Message-State: AOJu0YyYwTvh7wlGdfjDaD8E/3P/hqjtcr9Qw846tO4VHU4KhCTmjghd JkF4b2dzIEfz4A45+hWcr6MbwUYu1kjabB6EQoW7U1oiJ+553wr9CI1bdwv7p6WDOsAIuj+L1Ui JCIpIqoAHZYN7UbfD3JEmWukBA5x/n/doIArZY10yPyFfKddrGNFDi9IKCBvwEKqsS9uV9Qc6K8 Rv1qUf2gkGpCC/PbMC9C5LKfwNTg7l8V1GosuZ+n+PpbTREX4JCA== X-Google-Smtp-Source: AGHT+IFeYnzMx2Ix/ExHf0WtPzPyEdNaafm/mqjbU06ugYBQ/Bsocr/td93fO8+OVld/lXTxoVHlcsZ7oniz X-Received: from dlbuu1.prod.google.com ([2002:a05:7022:7e81:b0:119:c6ec:cc42]) (user=ynaffit job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:619e:b0:11a:3734:3db3 with SMTP id a92af1059eb24-11b411ff71amr1988486c88.32.1763163132044; Fri, 14 Nov 2025 15:32:12 -0800 (PST) Date: Fri, 14 Nov 2025 15:31:52 -0800 In-Reply-To: <20251114233150.396974-4-ynaffit@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251114233150.396974-4-ynaffit@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251114233150.396974-5-ynaffit@google.com> Subject: [PATCH 2/3] checkpatch: check indentation on case without space From: Tiffany Yang To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn Content-Type: text/plain; charset="UTF-8" The script was not catching switch statement indentation errors when 'case' isn't followed by a space. For example, checkpatch is silent for this change: +switch (foo) { +case(1): + break; + case(2): + break; +} But reports an error for the following: +switch (foo) { +case 1: + break; + case 2: + break; +} ERROR: switch and case should be at the same indent #39: FILE: kernel/checkpatch_case_fix/test_cases.c:21: +switch (foo) { [...] + case 2: Update the check so that the error is reported for both. Signed-off-by: Tiffany Yang --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b026b1235079..f9d14115c416 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4311,7 +4311,7 @@ sub process { shift(@ctx); for my $ctx (@ctx) { my ($clen, $cindent) = line_stats($ctx); - if ($ctx =~ /^\+\s*(case\s+|default:)/ && + if ($ctx =~ /^\+\s*(case\b\s*|default:)/ && $indent != $cindent) { $err .= "$sep$ctx\n"; $sep = ''; -- 2.52.0.rc1.455.g30608eb744-goog