Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752860AbbDCQvZ (ORCPT ); Fri, 3 Apr 2015 12:51:25 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:31438 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752507AbbDCQvX (ORCPT ); Fri, 3 Apr 2015 12:51:23 -0400 Date: Fri, 3 Apr 2015 19:51:13 +0300 From: Dan Carpenter To: Amitoj Kaur Chawla Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value Message-ID: <20150403165113.GU10964@mwanda> References: <20150403164211.GA6422@amitoj-Inspiron-3542> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150403164211.GA6422@amitoj-Inspiron-3542> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 966 Lines: 30 On Fri, Apr 03, 2015 at 10:12:11PM +0530, Amitoj Kaur Chawla wrote: > Removes variable comparison with 0 by using !. Sometimes testing for zero makes sense. When you write code, you are telling a story. If you are talking about zero as a number then it can make sense. If it's zero as a boolean then it doesn't make sense. Also strcmp() and similar should always be done as == 0, < 0 or != 0 because that is the idiom: if name != "foo" then becomes: if (strcmpt(name, "foo") != 0) { The != from the first is shifted in the second. So I don't really think this approach is the right thing. You have to read the code and understand the story it is telling. Then change it if needed. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/