Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp753888pxk; Thu, 17 Sep 2020 15:36:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIAy7DT3d2WjNu0CU6kcZkvXnNlev1uLlcv4VA3a19Ng26UsZqLlmJ77uj2/6FLeXJ5vK8 X-Received: by 2002:a17:907:4035:: with SMTP id nk5mr32291363ejb.418.1600382210214; Thu, 17 Sep 2020 15:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600382210; cv=none; d=google.com; s=arc-20160816; b=HSIuVoVtRuqU24/rvcQCfiOSKeTyvGi6l2yY8PvtBX+GGIAgtQCraivM9MS+ZjoA9O R8tRIHeF61jSEpANHLKk54+KB+w13B9TeBevQLFeBV4lck89TS6of5qk9CGj8ylMXQlh jOqZbun0Yu8cMqhDEa9ktt1jclwJcyLW7HWa6Tc88KwsdfjNqgRhDbk+nRgYRfSwpL3P 2TlihB0ZDYi9ZVkHjNDJY04Gjtv2lDvYtUvYIBFcAnFGKwFeQXPXXK2CN1IlfUOrE820 cl0kMAZTXvwNdbA0lvx/ZeUFpE+rHYFa0HUz0N1Vt93lXpfhpbzTSgYNytWM8jKDxSOo cC2Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MdQ8ua5QG4xxf9OHDihHEvA9xjajveBMDUZ1jFKZnXE=; b=ZYvTLpUQ2/JU3AV0c5fYNCbkxsoqWBITurcGO/b2QjaBk1i7Xfk4ASdJJh48eTVa1w 66GPHz+M8uujEAFvyxk5oho94OQTdYuUToW2+j7HxcQu8qV+xqC6DjMb93/cyIju9KDG M4lWHUi1E8borqwJtAAuRCMWhe636mB/gQVBWu2fA5OJNGXZCwXa+cjlBFwtjPqWBLAN KI9R9QcbL9JirCfaTtw4liApEkIR83RSjfMSXcs922UHHF6w3yjJONF1TU5Z+sfj3wcp hchvHDieea5Ys1jEWEzLQefI6MT8BuVtitBvgZlTt5lUM9VYM6RDJdTeEFYuK5XlTQNI GlLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nic.cz header.s=default header.b=OgRyHIN4; 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=nic.cz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si942194eje.544.2020.09.17.15.36.27; Thu, 17 Sep 2020 15:36:50 -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=@nic.cz header.s=default header.b=OgRyHIN4; 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=nic.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726626AbgIQWe7 (ORCPT + 99 others); Thu, 17 Sep 2020 18:34:59 -0400 Received: from lists.nic.cz ([217.31.204.67]:35608 "EHLO mail.nic.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbgIQWeR (ORCPT ); Thu, 17 Sep 2020 18:34:17 -0400 Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:cac7:3539:7f1f:463]) by mail.nic.cz (Postfix) with ESMTP id F0E8014206A; Fri, 18 Sep 2020 00:34:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1600382042; bh=HVFvswxzbeVibIz+rP76hH502Bso/ThNxjGcG/8nNV4=; h=From:To:Date; b=OgRyHIN4ZntvYawIHcV9oepEUjzkurpVyXAsBiIag0UAKc/AJYNVmoHqth+gL9aE6 fGEgVLnwsDmbX1ZNHJ6PIN+fFvAriiYLfgcj3yG5lGBCNmditTucb376OE1NuEEuk4 gakDBjOyDocE5bKG4jtve7zPjm83te4dRZl695SA= From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: linux-leds@vger.kernel.org Cc: Pavel Machek , Dan Murphy , =?UTF-8?q?Ond=C5=99ej=20Jirman?= , linux-kernel@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= , Simon Guinot , Simon Guinot , Vincent Donnefort , Thomas Petazzoni , Linus Walleij Subject: [PATCH leds v2 46/50] leds: ns2: remove unneeded variable Date: Fri, 18 Sep 2020 00:33:34 +0200 Message-Id: <20200917223338.14164-47-marek.behun@nic.cz> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200917223338.14164-1-marek.behun@nic.cz> References: <20200917223338.14164-1-marek.behun@nic.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.nic.cz X-Spam-Status: No, score=0.00 X-Spamd-Bar: / X-Virus-Scanned: clamav-milter 0.102.2 at mail X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No need to use variable found, we can determine whether the mode was found by comparing iterator variable to its limit. Signed-off-by: Marek BehĂșn Cc: Simon Guinot Cc: Simon Guinot Cc: Vincent Donnefort Cc: Thomas Petazzoni Cc: Linus Walleij --- drivers/leds/leds-ns2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 9d9c9ff4dce61..e94bb8535f0a7 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c @@ -71,16 +71,13 @@ static int ns2_led_get_mode(struct ns2_led *led, enum ns2_led_modes *mode) static void ns2_led_set_mode(struct ns2_led *led, enum ns2_led_modes mode) { int i; - bool found = false; unsigned long flags; for (i = 0; i < led->num_modes; i++) - if (mode == led->modval[i].mode) { - found = true; + if (mode == led->modval[i].mode) break; - } - if (!found) + if (i == led->num_modes) return; write_lock_irqsave(&led->rw_lock, flags); -- 2.26.2