Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753387AbbDCRDV (ORCPT ); Fri, 3 Apr 2015 13:03:21 -0400 Received: from mail-qc0-f182.google.com ([209.85.216.182]:33161 "EHLO mail-qc0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753357AbbDCRDS (ORCPT ); Fri, 3 Apr 2015 13:03:18 -0400 MIME-Version: 1.0 In-Reply-To: <20150403165113.GU10964@mwanda> References: <20150403164211.GA6422@amitoj-Inspiron-3542> <20150403165113.GU10964@mwanda> Date: Fri, 3 Apr 2015 22:33:17 +0530 Message-ID: Subject: Re: [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value From: Amitoj Kaur Chawla To: Dan Carpenter Cc: Greg KH , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1156 Lines: 36 On Fri, Apr 3, 2015 at 10:21 PM, Dan Carpenter wrote: > > 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. > Thank you for the advice! I will look into it! -- Regards, Amitoj Kaur Chawla -- 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/