Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp654194ybt; Wed, 24 Jun 2020 08:05:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv+RNjLT7R/qy4j1ZYNfuhbheP0WKqTXHS3IGMr1XIqpT9jpT1N4YjuxdaeSZw6Rlbw2qS X-Received: by 2002:a17:906:ae88:: with SMTP id md8mr26656768ejb.347.1593011137261; Wed, 24 Jun 2020 08:05:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593011137; cv=none; d=google.com; s=arc-20160816; b=TUCOF5+KJ8m1/L8iKWBAyM9jlqncW/VeASj/x2pZAMzk6NtgTtV8/nGRJBzooSjuuH MW7dBzf0DBHcfG7OqlPES2nir40P813Fg+QWAwKB6Ar3GWKH/lLY3KeTe9ukq7zoOyB5 4h77b1BLSEOD8yCGx9PeFtEvwpMu8+yCoSy5hIeFfuhlmoO6ZFSCpoueAebIKyQdWqVG ts4mSlEDordlSen7jnJLrs4hdmU/TFdsFinJalCP6OLwbNRHwRDNDUVMUqkYgsD0pp63 Q0vE27Pygb/wTEeDz8YCc2LT00paAS9dsLhF0aESySlIP+HWTc3xaUSIo5/4eXhTeopl c0fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ss7PoxbYLKDr3LBMlu1h9z6F9Bwyl8YcpPLuuDtA3OM=; b=U8Be05A6LzZ45+mtBCUqjgzdYOuAGKuXQyZqw9WWqNJZlx4UmSDE/eNMqng7wSxKh0 2eGxmrI/9la5q4xqWuuA30nA4oPo9xUvWK+4vaHGqSWsjM0RiykGJSYJ5eIV9ccygYJF QnJQEpEOtHZ1T+C/frAUGXPiOpVht4l9tymfM7WAFykhMqvnwg7qFQxR3ClVl/oWmDqY dEQQDp573i1KB53ndxcRbI9YdX9PU+37tB2lN0LHudwJ5eczO/Mdm6i8pB5wOqrloUee hXEFb1mExFPpiWfH8rHzTxtoICz8WjBotNVWcbgLA5W1ahfq7jRuhgZFM2aOhVfFESzS uuhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zQRqE+UP; 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 mf5si12354387ejb.186.2020.06.24.08.05.13; Wed, 24 Jun 2020 08:05:37 -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=zQRqE+UP; 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 S2404374AbgFXPEy (ORCPT + 99 others); Wed, 24 Jun 2020 11:04:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404362AbgFXPEv (ORCPT ); Wed, 24 Jun 2020 11:04:51 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CA4CC0613ED for ; Wed, 24 Jun 2020 08:04:51 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id b6so2604198wrs.11 for ; Wed, 24 Jun 2020 08:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ss7PoxbYLKDr3LBMlu1h9z6F9Bwyl8YcpPLuuDtA3OM=; b=zQRqE+UPlzudn+/cNp26hST9pkqlAF/Roysjl/ZK7hSOKrbhU0+ps/0hPMPZsbtq/y 7wkqhhZfdcOFJBlLfaVIq6w0vtexOBLwbp/pjJGSxtLakMB6+zk27rhGv9J+ON8zZ6kn fzdXdcthiNFm1fkpxraeMNnxwh/t26zQo4S5e/5NFtzLHCzm4EadHFojnWIy7JuQe9cK 6ySZiZs6+kQpTsrLLTyxUW9nVNMXkbf3Ry1jJreYdNgKWyGYrXJxBMXhSJlWyVkmkG+7 0TNrihNQNOQlLEAzLWkhnniT+Ri1c30kv54Kd4HYaALy++kosXWN5+toAf8VcB8ifg3z Us4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ss7PoxbYLKDr3LBMlu1h9z6F9Bwyl8YcpPLuuDtA3OM=; b=O3FelELkBLutM0dnUDPk+FT4uopXVRh5R4IS7yvqubTEngA86WT0oSSVSYDuzk2JKO m3egziSzJf+UBsloJTW0ch18dtWZqUzhoNy2nDw0B7HPkq7krHmLD2sIIDhi9HEzByaG CV0WSpSuRjS7zh4kavJ0yUE+ffPQoNDFpJakfNGIvcw7Nx6xDSYOGyCXm71jzxSb0FBX cSKtXq4OYGyG0BOxEWPedoU4/S2MYYf0CNsrSAuhgJk22vvBQunNM2icdD5qcLtJywxu HRw70P38ziqYK6ELzDeFgqpfE1sBj1g4L+L8susFnN9mY44UQFL1vSJl1gBu9W6upMwn o+Rg== X-Gm-Message-State: AOAM533nSghlL16zGuBuOQQ8HFPbavtpsGMFobdj4CjknDricpVA0+B2 OnLt1cNkbog7bqR0siXk6fe7SQ== X-Received: by 2002:a5d:6a07:: with SMTP id m7mr32024458wru.324.1593011089754; Wed, 24 Jun 2020 08:04:49 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.144]) by smtp.gmail.com with ESMTPSA id f186sm8200319wmf.29.2020.06.24.08.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:04:49 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, jingoohan1@gmail.com, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lee Jones , stable@vger.kernel.org, Bartlomiej Zolnierkiewicz , Daniel Jeong , LDD MLP Subject: [PATCH 7/8] backlight: lm3630a_bl: Remove invalid checks for unsigned int < 0 Date: Wed, 24 Jun 2020 15:57:20 +0100 Message-Id: <20200624145721.2590327-8-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200624145721.2590327-1-lee.jones@linaro.org> References: <20200624145721.2590327-1-lee.jones@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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