From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752898AbcKRLMv (ORCPT ); Fri, 18 Nov 2016 06:12:51 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:25676 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243AbcKRLMt (ORCPT ); Fri, 18 Nov 2016 06:12:49 -0500 Date: Fri, 18 Nov 2016 14:01:27 +0300 From: Dan Carpenter To: James Simmons Cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH 12/19] staging: lustre: libcfs: remove == 0 testing Message-ID: <20161118105235.GB6266@mwanda> References: <1479411357-28979-1-git-send-email-jsimmons@infradead.org> <1479411357-28979-13-git-send-email-jsimmons@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479411357-28979-13-git-send-email-jsimmons@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 17, 2016 at 02:35:50PM -0500, James Simmons wrote: > Testing == 0 is not kernel style so remove this > type of testing from libcfs. > That's not true. Checkpatch.pl won't complain. Not everyone has thought about it or agrees with me but there are time when == 0 is idiomatic. For example, if you are talking about the *number* zero then it should probably be == 0. If it's like "rc == 0" then "rc" doesn't mean the number it means success/fail so it should be "if (!rc) ". But it's intuitive to say "if (len == 0) ". The other place is strcmp() and friends where it's much more intuitive: strcmp(a, b) == 0 means a == b strcmp(a, b) < 0 means a < b strcmp(a, b) != 0 means a != b regards, dan carpenter