Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1313023ybt; Thu, 25 Jun 2020 03:05:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjhSJmnD6jppKQ1Y+EChuWDA6kp/X+akrxaa3xpAPnzsqA33Koa/13Q2AbSKIybodnO7sO X-Received: by 2002:a50:e08c:: with SMTP id f12mr31116640edl.233.1593079544153; Thu, 25 Jun 2020 03:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593079544; cv=none; d=google.com; s=arc-20160816; b=B4/J2Fsx9W71NunEfqhtaYgbd+Hj1cVTiDGi6+8+jR3bZbjeArNi4LoIcQib4cfVB4 unp+WDtTKEKvw/S8m9b5wgeGPXA+Itz/c1LIfh6HpndgJgm1Ay7HGMwK+KyV9xv5P+HE S2dJFVzaw9rmvDsfkF/laPXYiFL+xfZw4QhpNVSgF03wbBMqscINYWAYEirH1OY8tYgS kclErA9OToK+XplfHTBF9kolpBZHwp6NGR4F/YkEwBZuhNeyks0mVZVbg1d0WirQxNNE 6dHyd+fOshePx9K9+n7IaSwmPSvFW/bUXyOo9+jXl94RhUQQ25vZBA1IOG8Nexfzafpb GmVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=T96Cw/B2VdIT350ot7UQTHC8Op+bJn2wrxV9Mj1Tufs=; b=edkRjnNSGAA2I8Mkw6RC1uYZUeOU+N+Zys11bUUpdczaWs2JqtDqy5RPRvodbkq8uR xgSy+r1mtYwS6yVRfxW/uhLJm9xZb2a0j2aHlFOk2bR1xFUHF1vN/1vcjFAQ9kN570xO Ed98Ru/YVbxe5rsNVpuvdVncNZBf9jRQZc+4uoacKtq9DTaCYto7tfbZCx20PDEziXrO Baz8lIC+T1JGOspnRwjpA010mhMiDpn8+qg+4iJcoOUfcfuYrF8uuPEzHy+Oog6lzqMY pnEd8mwpqPn1kngy0tX/gaR8b1Faz0kwxd1D2PG1SO6TXWKgyGtyYLSBD3F5JThRSAFb tW7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UgGBQ040; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si1937edr.42.2020.06.25.03.05.21; Thu, 25 Jun 2020 03:05:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UgGBQ040; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403948AbgFYJpP (ORCPT + 99 others); Thu, 25 Jun 2020 05:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390657AbgFYJpL (ORCPT ); Thu, 25 Jun 2020 05:45:11 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3174FC061573 for ; Thu, 25 Jun 2020 02:45:11 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id t194so5230875wmt.4 for ; Thu, 25 Jun 2020 02:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=T96Cw/B2VdIT350ot7UQTHC8Op+bJn2wrxV9Mj1Tufs=; b=UgGBQ0407zaBUunWxSaTxaAU9RpsMyNFk0zmjnxT4oUPgOMS0mUttZchCHkE/Duc81 3Euu/xzSY0D/RHY6H3f+8L7EBv9pJX6LJ1rgu8XHtFP5DLdQy2U6XBszjzYjLcoASf4o 13aHCVwSn20u5Y3Rjp5ofbVSJfgcaQlozvioeTOq9qtTjkWRatE7Nw+DInt6u9IlcT8D WKiewW7DiiF1VAoAWFrcuQ7Gn9Z7Bx8CXeSjsrM0QoK+BF8FVXERG33Pivml1z/BFL3x Pu8dqCmf4p41S4/ENV7loy9Ht76Jl+v26ayWmEU+FNaUyCIDZiOvcHBccY3I3p5geuLQ ///Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=T96Cw/B2VdIT350ot7UQTHC8Op+bJn2wrxV9Mj1Tufs=; b=RinUYjpv6DY5pK/3oOo5sVMefBWGHFcbwXJd9Jqqb1HT2+V2xDFfYK39+TbolqedUU zqBb8aEJsFK7gSCx7Apcxa2+nVDh6teKOTwedarAAC3asSx8sIu1vm0Eg+T7+Yiw4gI1 a0wAU4eOQiU1P9B5zMKIW6We7EXO3Qym0YSq3GYY+SDZPEeDB1zsJqlYPu9zDUskbssa PrSPWo9TdIGmvoOaCzpRUV7uVrK/FeiWdRMzTHoVu5ZRXt/ghvI6ni1jQDThiNDAOuPU 41JPbORLy8I4juNSdbddZHsBCmyJGCqfHjh4AvjVVGBRtuh6RHe6hZklc5i4aGEckfZW HxKA== X-Gm-Message-State: AOAM530mUIZSSWd9VJV7ntdgu5GIISia/FYLPZN0eq8cp2FM+44uPHpG NUQqsAMQpJjs21hM+6T7e5XLQw== X-Received: by 2002:a7b:c186:: with SMTP id y6mr2558934wmi.82.1593078309869; Thu, 25 Jun 2020 02:45:09 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id t15sm11708554wmj.14.2020.06.25.02.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 02:45:09 -0700 (PDT) Date: Thu, 25 Jun 2020 10:45:07 +0100 From: Daniel Thompson To: Lee Jones Cc: jingoohan1@gmail.com, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Bartlomiej Zolnierkiewicz , Daniel Jeong , LDD MLP Subject: Re: [PATCH 7/8] backlight: lm3630a_bl: Remove invalid checks for unsigned int < 0 Message-ID: <20200625094507.5ozmizkynmlwvyoj@holly.lan> References: <20200624145721.2590327-1-lee.jones@linaro.org> <20200624145721.2590327-8-lee.jones@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200624145721.2590327-8-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 03:57:20PM +0100, Lee Jones wrote: > unsigned ints 'sources' and 'bank' cannot be less than LM3630A_SINK_0 (0) > and LM3630A_BANK_0 (0) respecitively, so change the logic to only check > for thier two possible valid values. > > Fixes W=1 warnings: > > drivers/video/backlight/lm3630a_bl.c: In function ‘lm3630a_parse_led_sources’: > drivers/video/backlight/lm3630a_bl.c:394:18: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] > 394 | if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1) > | ^ > drivers/video/backlight/lm3630a_bl.c: In function ‘lm3630a_parse_bank’: > drivers/video/backlight/lm3630a_bl.c:415:11: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] > 415 | if (bank < LM3630A_BANK_0 || bank > LM3630A_BANK_1) > | ^ > > Cc: > Cc: Bartlomiej Zolnierkiewicz > Cc: Daniel Jeong > Cc: LDD MLP > Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson > --- > drivers/video/backlight/lm3630a_bl.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c > index ee320883b7108..e88a2b0e59046 100644 > --- a/drivers/video/backlight/lm3630a_bl.c > +++ b/drivers/video/backlight/lm3630a_bl.c > @@ -391,7 +391,7 @@ static int lm3630a_parse_led_sources(struct fwnode_handle *node, > return ret; > > for (i = 0; i < num_sources; i++) { > - if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1) > + if (sources[i] != LM3630A_SINK_0 && sources[i] != LM3630A_SINK_1) > return -EINVAL; > > ret |= BIT(sources[i]); > @@ -412,7 +412,7 @@ static int lm3630a_parse_bank(struct lm3630a_platform_data *pdata, > if (ret) > return ret; > > - if (bank < LM3630A_BANK_0 || bank > LM3630A_BANK_1) > + if (bank != LM3630A_BANK_0 && bank != LM3630A_BANK_1) > return -EINVAL; > > led_sources = lm3630a_parse_led_sources(node, BIT(bank)); > -- > 2.25.1 >