From patchwork Fri Jan 24 16:54:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 209183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73ECBC3F68F for ; Fri, 24 Jan 2020 17:00:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 544CA20709 for ; Fri, 24 Jan 2020 17:00:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389807AbgAXRAN (ORCPT ); Fri, 24 Jan 2020 12:00:13 -0500 Received: from antares.kleine-koenig.org ([94.130.110.236]:38626 "EHLO antares.kleine-koenig.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389553AbgAXRAN (ORCPT ); Fri, 24 Jan 2020 12:00:13 -0500 X-Greylist: delayed 358 seconds by postgrey-1.27 at vger.kernel.org; Fri, 24 Jan 2020 12:00:12 EST Received: by antares.kleine-koenig.org (Postfix, from userid 1000) id 923928CCA2C; Fri, 24 Jan 2020 17:54:14 +0100 (CET) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jacek Anaszewski , Pavel Machek Cc: Jeff LaBundy , Dan Murphy , Thierry Reding , linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org Subject: [PATCH 1/3] leds: pwm: simplify if condition Date: Fri, 24 Jan 2020 17:54:07 +0100 Message-Id: <20200124165409.12422-2-uwe@kleine-koenig.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200124165409.12422-1-uwe@kleine-koenig.org> References: <20200124165409.12422-1-uwe@kleine-koenig.org> MIME-Version: 1.0 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org .pwm_period_ns is an unsigned integer. So when led->pwm_period_ns > 0 is false, we now assign 0 to a value that is already 0, so it doesn't hurt and we can skip checking the actual value. Signed-off-by: Uwe Kleine-König --- drivers/leds/leds-pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index 8b6965a563e9..b72fd89ff390 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c @@ -102,7 +102,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv, pwm_get_args(led_data->pwm, &pargs); led_data->period = pargs.period; - if (!led_data->period && (led->pwm_period_ns > 0)) + if (!led_data->period) led_data->period = led->pwm_period_ns; ret = devm_led_classdev_register(dev, &led_data->cdev);