From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next] bnxt_en: Remove unnecessary unsigned integer comparison and initialize variable Date: Sun, 07 Oct 2018 20:37:39 -0700 (PDT) Message-ID: <20181007.203739.679737551060624652.davem@davemloft.net> References: <20181005201209.GA16515@embeddedor.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: michael.chan@broadcom.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: gustavo@embeddedor.com Return-path: In-Reply-To: <20181005201209.GA16515@embeddedor.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: "Gustavo A. R. Silva" Date: Fri, 5 Oct 2018 22:12:09 +0200 > There is no need to compare *val.vu32* with < 0 because > such variable is of type u32 (32 bits, unsigned), making it > impossible to hold a negative value. Fix this by removing > such comparison. > > Also, initialize variable *max_val* to -1, just in case > it is not initialized to either BNXT_MSIX_VEC_MAX or > BNXT_MSIX_VEC_MIN_MAX before using it in a comparison > with val.vu32 at line 159: > > if (val.vu32 > max_val) > > Addresses-Coverity-ID: 1473915 ("Unsigned compared against 0") > Addresses-Coverity-ID: 1473920 ("Uninitialized scalar variable") > Signed-off-by: Gustavo A. R. Silva Applied.