Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp412203rwd; Tue, 30 May 2023 23:24:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ieX6j87JkEHzBH5WqNAZTc3wmptAgabqwg8kxcLhXbeofnOCvFu/mQ2lAgznyYujmnO2I X-Received: by 2002:a05:6358:2907:b0:123:318d:f924 with SMTP id y7-20020a056358290700b00123318df924mr1091220rwb.27.1685514278599; Tue, 30 May 2023 23:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685514278; cv=none; d=google.com; s=arc-20160816; b=L55lrXZG0CDBtHb+XsZ+qC4wshpA1v3Q4Z5e/FrkhzATO43pjY3QQKYW0pueQ+mLqY D3l5EE57E92it3QvyCHjAn5JAAcfi+cXJAW01xXjpmeaGJ55XE0ShJvqOH7r7qTlm1mg GxgbDOU+cT2kQ4CHUXBQHPmnfWU2iK6pt+GIizEJTLhF3YCcZUZR1we91UJEFCr8XwDM x8VfgQObi0JaqBbtJRFWPC4OBaPRe7RSgzUMg73PokOmGi1tfCkv3q0fqM5Haan/jxtn NZPH2kNEEk7kpsp92W6TguRCIBBKx209G/ygn6Ed1K6CyPYU2vQ/jT9xZOv7N5F+bN47 xtHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=n2EeMrdfr5wDxb2eZxsqBeZ0jfN7UYvorqxNMkGj3/I=; b=JRqHXsq1DsbtVKE/GBVBKvooE8Z/QuDRb0/fLyFeeMRCAGB2/Iyfmisnxhlz5EsKgP ql6ygkwUDcXjeZPghnMIxPOtk4eoZ3NX9weSHtOgaAXwsroKzN46n9uSqt+H2pez/khV awkTliGmrGlMBwHdxx6ihjVm5dYYeGJJb/cd6MiHcQOm1IqBVOxGjdAklXIE8ps29xXs ObG3zx3vv2W19RS/XQ4ofrGK90YMncLmkb4mEoLT8AuVM7sO91XP+W+3NgDHXJPTjU/9 fIji9ugNDSaT8436GAhAb7dAiEhNkv9TcXpKGPBNRYIlHXD6ywM20pk5hVNe7YvIueEe QeXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a638f51000000b0053ef815daebsi501060pgn.253.2023.05.30.23.24.26; Tue, 30 May 2023 23:24:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231876AbjEaFgW (ORCPT + 99 others); Wed, 31 May 2023 01:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229865AbjEaFgV (ORCPT ); Wed, 31 May 2023 01:36:21 -0400 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62345D9; Tue, 30 May 2023 22:36:19 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R561e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjwC2E9_1685511360; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VjwC2E9_1685511360) by smtp.aliyun-inc.com; Wed, 31 May 2023 13:36:15 +0800 From: Jiapeng Chong To: pavel@ucw.cz Cc: lee@kernel.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] leds: flash: leds-qcom-flash: Fix an unsigned comparison which can never be negative Date: Wed, 31 May 2023 13:35:59 +0800 Message-Id: <20230531053559.5702-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The variable 'count' is defined as unsigned type, so the following if statement is invalid, we can modify the type of count to int. if (count <= 0) { dev_err(dev, "No led-sources specified\n"); return -ENODEV; } ./drivers/leds/flash/leds-qcom-flash.c:546:5-10: WARNING: Unsigned expression compared with zero: count <= 0. Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5344 Signed-off-by: Jiapeng Chong --- drivers/leds/flash/leds-qcom-flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c index c8d41a3caf38..b089ca1a1901 100644 --- a/drivers/leds/flash/leds-qcom-flash.c +++ b/drivers/leds/flash/leds-qcom-flash.c @@ -538,9 +538,9 @@ static int qcom_flash_register_led_device(struct device *dev, struct led_init_data init_data; struct led_classdev_flash *flash = &led->flash; struct led_flash_setting *brightness, *timeout; - u32 count, current_ua, timeout_us; + u32 current_ua, timeout_us; u32 channels[4]; - int i, rc; + int i, rc, count; count = fwnode_property_count_u32(node, "led-sources"); if (count <= 0) { -- 2.20.1.7.g153144c