Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A71BC2D0E4 for ; Tue, 17 Nov 2020 10:52:52 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B9922463F for ; Tue, 17 Nov 2020 10:52:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DbhikWaZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B9922463F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-kernel-mentees-bounces@lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A2DCD85B9A; Tue, 17 Nov 2020 10:52:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xk4h1TV1aBuu; Tue, 17 Nov 2020 10:52:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 31BD685C43; Tue, 17 Nov 2020 10:52:50 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1A64DC0891; Tue, 17 Nov 2020 10:52:50 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4EFD6C07FF for ; Tue, 17 Nov 2020 10:52:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 32DCE20454 for ; Tue, 17 Nov 2020 10:52:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6oNPDQ56zFsv for ; Tue, 17 Nov 2020 10:52:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by silver.osuosl.org (Postfix) with ESMTPS id A9BF820111 for ; Tue, 17 Nov 2020 10:52:48 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id 34so12598708pgp.10 for ; Tue, 17 Nov 2020 02:52:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=wcMZTaIPkIt9BoToXvaICe5+QNibl67EVvBUxobxY0o=; b=DbhikWaZXEBuvC6Y6+U/bYpJl8MEtJVkNRM1Qd+YWChqpvh36A4Ny1oaOXYqgqmDH1 1dkTF4ptwoJXnBcGUSZvGopNkrLmajTWcNOfzqrZskkflGyhxx3jwCkhnRHekfok+2Kh nMVmqzUuWc+6uRSMsTkx6aMR1/OIzfvJatmnSXAsn/zefObwsezxbcAJbQ0KLvMzkyp9 VwhoqOV/1U9rzgf4/R4NW6kepzSIGfS3kn61chLGir9N3JXWZje9sJB1j2R9W+5iC9KY At85mpMBMRZp0QYlk10qWEf2ZeFhfP4zdaPN1D7L5YWtMEAJPTGzfHTfNaICO5l51UQ7 8QMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wcMZTaIPkIt9BoToXvaICe5+QNibl67EVvBUxobxY0o=; b=NPIRMUanBCn8wMsg4MXkQN4pAeEx1sUKlepgB2T0G7iBMTccREkPAVsIjrkxFXr8c2 /VFBmd0d4Gqs3v8ewKA98PgOZVFT2ghh2OivNVyWwES8MoKs3LjnfA2pXp+JE439d0wy vpra0k02U3pJw1vTQiKTmK762tCCABx4DJxzqqHHfJDsdWTsVn0QklpimPduw8/chFUh FSQU/Vs5ITVkuud2GJK5aasxO1/AL1a8zdm2UUU7l1fWzzmy/3WQUKhofRy+ntFE2XtW X/afJRdf7ebNBLIAB8hRbPn2WQNCjbMNtHMt/w5wW6GmD7+rH/XwNpAFrWuo/pmZ4riy GSnQ== X-Gm-Message-State: AOAM530CSWg+FL3/KUqM9DruUME0QXL/tYF3H9uc6gwpZVxXwJtohb8W JcP9uLbOz+ylFjr2ZIBfsf8= X-Google-Smtp-Source: ABdhPJxTSYrBNHKDjf2yB9lt1w4xadMNX2xQDvp6BWuCzFzbiangG/y/yA48FpkP6l2/huNkBgd2kA== X-Received: by 2002:a63:1142:: with SMTP id 2mr3092932pgr.103.1605610368217; Tue, 17 Nov 2020 02:52:48 -0800 (PST) Received: from localhost.localdomain ([2402:3a80:425:6282:bc1b:1de0:7718:e8a1]) by smtp.googlemail.com with ESMTPSA id x28sm8773391pgk.21.2020.11.17.02.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 02:52:47 -0800 (PST) From: Aditya Srivastava To: joe@perches.com Date: Tue, 17 Nov 2020 16:22:37 +0530 Message-Id: <20201117105237.757-1-yashsri421@gmail.com> X-Mailer: git-send-email 2.17.1 Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, yashsri421@gmail.com Subject: [Linux-kernel-mentees] [PATCH v2] checkpatch: add fix option for ASSIGNMENT_CONTINUATIONS X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" Currently, checkpatch warns us if an assignment operator is placed at the start of a line and not at the end of previous line. E.g., running checkpatch on commit 8195b1396ec8 ("hv_netvsc: fix deadlock on hotplug") reports: CHECK: Assignment operator '=' should be on the previous line + struct netvsc_device *nvdev + = container_of(w, struct netvsc_device, subchan_work); Provide a simple fix by appending assignment operator to the previous line and removing from the current line, if both the lines are additions (ie start with '+') Signed-off-by: Aditya Srivastava --- Changes in v2: add check if both the lines are additions (ie start with '+') scripts/checkpatch.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c9aaaa443265..e0cb36369b2f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3542,8 +3542,14 @@ sub process { # check for assignments on the start of a line if ($sline =~ /^\+\s+($Assignment)[^=]/) { - CHK("ASSIGNMENT_CONTINUATIONS", - "Assignment operator '$1' should be on the previous line\n" . $hereprev); + my $operator = $1; + if (CHK("ASSIGNMENT_CONTINUATIONS", + "Assignment operator '$1' should be on the previous line\n" . $hereprev) && + $fix && $prevrawline =~ /^\+/) { + # add assignment operator to the previous line, remove from current line + $fixed[$fixlinenr - 1] .= " $operator"; + $fixed[$fixlinenr] =~ s/$operator\s*//; + } } # check for && or || at the start of a line -- 2.17.1 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees