Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp250709ybl; Wed, 11 Dec 2019 17:35:38 -0800 (PST) X-Google-Smtp-Source: APXvYqwq72XabXHpKQBPIGSK0SymCqSAbFWP8E8JRDfERcKCwRnVx4wX0bfWBITDmtraC2pRzw2j X-Received: by 2002:a9d:6d06:: with SMTP id o6mr5279860otp.239.1576114537913; Wed, 11 Dec 2019 17:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576114537; cv=none; d=google.com; s=arc-20160816; b=Slkj+gOqPv/QlKIf87Q6SlYR/8WdopCbpUiF7NjezCyzAw09EykJXk1iUTkVOTtsow 4JKcwPMZYuiHqHd4oxDgI6EJ+pLFGa3Q5iPGxE+AnzIwjltJj/KPwdVJOSKteA5HgROM w72oWd9j3pXzvaNlXhSN66yXaFPE5ft6xDLf3WMlCV7uPvuQedB1T0wjldOyy0y/h3a3 LOrXpM5VBjCzwfGIbNI0guhtdQIV3jMZLd1SycDtTfKE1hXfwU3TJ95UR0gzY8LHjUjv XpIlxE7li4Th31vmU1YXA8wdEFRTf8o3rK+ucyG72KQUUGZLFv5aGKLmgVnAX2UARZA5 /hHg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lzwdJDAmxJY1eABknzBM4VRQbsIRzOn9IbtmF0lZgCU=; b=pvgbAFRXGNzz9moZZkZU43mp3uh1FI7NmBn1u3YlId5a3J8b6KVr6sfCUbTq1hfbh6 UYr/e4s3vtyEgTYCTFqsSWYKKfrQf5lQFcVgOUYqnpu/3ouZui59lMd9BuGcZ+vqvFWI XSKJjLM3SVkLFv94hreehcfnYYmf7xcnpOdnE/HW2JtTdQnFGJ+dap67ZroGGdhE6Iyo 3sdIxutU6eNeOBmrMGGkGTy9T/k4cQ4FVLNPmp/H5iOTGEQx8Laz0qNWby2G19kQFMHm SxDJBK6sLm5v1+S38kPmMY/D1XP/Hv73hof9r/d+Vc8kB/zrZaW7DjOUoLG2aR3poiC9 SiUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CnvWkqCI; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o15si2826037otp.314.2019.12.11.17.35.03; Wed, 11 Dec 2019 17:35:37 -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=@gmail.com header.s=20161025 header.b=CnvWkqCI; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727497AbfLLBdV (ORCPT + 99 others); Wed, 11 Dec 2019 20:33:21 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:34677 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727351AbfLLBdV (ORCPT ); Wed, 11 Dec 2019 20:33:21 -0500 Received: by mail-ot1-f65.google.com with SMTP id a15so769710otf.1; Wed, 11 Dec 2019 17:33:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=lzwdJDAmxJY1eABknzBM4VRQbsIRzOn9IbtmF0lZgCU=; b=CnvWkqCIuOLMkvjfdwAteNxGWDSx/41p6Mxfq1pDteizNN4eSX3TrU6hCvEzwzGHlL I2savvk5kobSLwvhb4l+JPtAKAh8/XZ1NmIkNmpROXN7N5lh5J9orwRJDGIkeTp1tL/E m0XcH3/8Eyh4ItkJ/KDVbAMRGKx2OhWPC0JfDvt0vhbj0O+CTVWUWartgVImJ0XYDshT 6VTQLpE9QWbAX6CpKEvQHP4K/cDUDi23fUOqxC0tjOkb0AryP2A0X8yURAUt1dvqC22c VwODXc0/eTYZdanR/YwU6TyOywUphf1zXBRPZIf9n5pQBT+I/xGvMyEv/8uJP8s6ftFw EtdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=lzwdJDAmxJY1eABknzBM4VRQbsIRzOn9IbtmF0lZgCU=; b=m0jOsNtog8EEZ/u2IZb6wSgEGtX0d3ISa23+XZV8gFjXMQzjYEdkjZ7y/jakWZX9xQ mASGPEG+N1UN1J7TqAM/mVuU0BRX2xdYaYfuxNKinBkAzopV7gQ4WzmQEPgEaUbKomIh l5pFJofALXhNj5hneZBx5R1aBqcmGYos78B3kf2tb6Ii8OHlS0ImNmufbL4wB4gz0CEz UkDzyKiCbTQ5czzdMPeHPAqkV7DxOrn3QlHq1hBrWjwgyMDKdcLWY2v5/JuvuiLn8A7B c0BAqiibI1YqxAoDH43YVuhKwPFGvRJ/YaD5x+ZWNo7srLMKm6zoSJ+Su/h40gz5Gsm9 tNOg== X-Gm-Message-State: APjAAAX2KS6xmRAwASB3kPJMVQsa2iyFtwBjkALk99+JLSF7wIRx0ILH qsMdjTW7i9fEgzNc1La6ODh0lNPqqiSUQDOekSc= X-Received: by 2002:a05:6830:158d:: with SMTP id i13mr5301485otr.33.1576114400042; Wed, 11 Dec 2019 17:33:20 -0800 (PST) MIME-Version: 1.0 References: <20191211111628.2955-1-max.hirsch@gmail.com> <20191211162654.GD6622@ziepe.ca> In-Reply-To: <20191211162654.GD6622@ziepe.ca> From: Max Hirsch Date: Wed, 11 Dec 2019 20:33:10 -0500 Message-ID: Subject: Re: [PATCH] RDMA/cma: Fix checkpatch error To: Jason Gunthorpe Cc: Doug Ledford , Parav Pandit , Leon Romanovsky , Steve Wise , Bart Van Assche , Danit Goldberg , Matthew Wilcox , Dag Moxnes , Myungho Jung , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for the quick response. This is my first patch, so I want to follow the correct protocol. I reran checkpatch after making the changes and there were no errors or warnings in the region I changed. ... WARNING: line over 80 characters #308: FILE: drivers/infiniband/core/cma.c:308: + return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)]= ; <<<<<<<<<<<<<<<<<< HERE IS WHERE THE ERROR WAS WARNING: line over 80 characters #495: FILE: drivers/infiniband/core/cma.c:495: + struct cma_multicast *mc =3D container_of(kref, struct cma_multicast, mcr= ef); ... I was have read that it is beneficial to make the changes very small. I wanted to target a specific checkpatch error. If you believe it would be better I can make a patch cleaning up the entire function. I can also make a second patch changing ret to a bool. I did not want to do that as a part of this patch because: I wanted a VERY small change (increase acceptance likelihood), and there is a specific protocol for submitting multiple commits in a patch, i.e. ordering them correctly. I did not want to introduce a potential error source when submitting a patch i.e. I submitted 2 commits in the wrong order. Since you have the comment to remove the brackets around the ret assign how would I go about modifying this patch? Should I resubmit a patch i.e. start a new email with with your proposed changes? On Wed, Dec 11, 2019 at 11:26 AM Jason Gunthorpe wrote: > > On Wed, Dec 11, 2019 at 11:16:26AM +0000, Max Hirsch wrote: > > When running checkpatch on cma.c the following error was found: > > I think checkpatch will complain about your patch, did you run it? > > > ERROR: do not use assignment in if condition > > #413: FILE: drivers/infiniband/tmp.c:413: > > + if ((ret =3D (id_priv->state =3D=3D comp))) > > > > This patch moves the assignment of ret to the previous line. The if sta= tement then checks the value of ret assigned on the previous line. The assi= gned value of ret is not changed. Testing involved recompiling and loading = the kernel. After the changes checkpatch does not report this the error in = cma.c. > > > > Signed-off-by: Max Hirsch > > drivers/infiniband/core/cma.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cm= a.c > > index 25f2b70fd8ef..bdb7a8493517 100644 > > +++ b/drivers/infiniband/core/cma.c > > @@ -410,7 +410,8 @@ static int cma_comp_exch(struct rdma_id_private *id= _priv, > > int ret; > > > > spin_lock_irqsave(&id_priv->lock, flags); > > - if ((ret =3D (id_priv->state =3D=3D comp))) > > + ret =3D (id_priv->state =3D=3D comp); > > Brackets are not needed > > Ret and the return result should be changed to a bool > > Jason