Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2583055rdg; Mon, 16 Oct 2023 08:36:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHu3DbUdCKqGYp9fhePUNuhgv4hVbEBnN6Vk5x/cgiEd/q2kAkqR5YQmB7yhzLW1QhGfDq7 X-Received: by 2002:a17:903:230f:b0:1ca:4d35:b2f3 with SMTP id d15-20020a170903230f00b001ca4d35b2f3mr4037121plh.67.1697470604903; Mon, 16 Oct 2023 08:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697470604; cv=none; d=google.com; s=arc-20160816; b=nHzv6F98PsaJuRirsAwdcFccdxBFbW98TjXo6ceyBszxJbmJW7fiD5f68v9AAfRPlA JCNLZFW8L9gu39bj0z9EJTZZGoP5+FOZ1xyTdiHX0cDng4x/aKRqGMBi/mnFKwnf/gkh 901W7Z6ZWx9UgqKRqwsGOZaafODY782iZxLZAeiegGUCTYAaRtAS2TRmhcNTW2FPvBDY PgHIFie+8yx7fvghXDuBPkl7WuXedI9PZXmc5wzgXJLl049ubsTkIHJbSlmy9hLDlKI3 JO8/YjAZB4EttAYeiuVoBejFTcbogWnU4fTf5kY+Hx20bjcb51JfcpTNTAWKecQSk9LG QUiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=pkxXrxFJoOfSag3lJcT86s5RRoGY5wj60RjfYJlKoAY=; fh=1TdMClr05n+S39GyflLYbiK7QAivGxFuL9ziSpIVlhs=; b=KlxdHHLN6Dj95NmHpcqGsQhCPQMZT4050aVr8i5C2hKuW7JHlYAEbyxm/MQdrVFOSG oikct8y1uhwWt6LpeP3JSRZURd7rGSg6iqBE0cJn3lbAmifOR/aOoJ1+Z1IFbeHTgI/f GrBhhx/pqK6/9tXt1qD2FtKmgMeqqAQM2dW0Uu2AhxWR/nTtTtfpwGPO1vGCvbtLYX5a jJJoOwpyVrfJMB9/dbZalhFay4nU7PjJ9iWL7MxcYZ/5alXSRDwbm9gJzLvf9QXKtGgj SRCGdkPvYBEi0k8F1uKQ0jNRyHF6zwnYYLty51unprgX+tCfID4nGDZ7DHEvOwLnjBnJ 4j2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TWSEBERu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id y10-20020a1709027c8a00b001c3671d3151si10202975pll.92.2023.10.16.08.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 08:36:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TWSEBERu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3BEB48099245; Mon, 16 Oct 2023 08:36:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232817AbjJPPge (ORCPT + 99 others); Mon, 16 Oct 2023 11:36:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232375AbjJPPgd (ORCPT ); Mon, 16 Oct 2023 11:36:33 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8764FF2 for ; Mon, 16 Oct 2023 08:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697470547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pkxXrxFJoOfSag3lJcT86s5RRoGY5wj60RjfYJlKoAY=; b=TWSEBERuVrMRTuWXzvHSbHQf2X8YlFPbnUuj8hR2AmZOuH9TIyY6O7G5+qDEMc7EqNyrEi lge9Tr+xSX+DOxIQb1O51jqtj75PfC1SFy7f17ircWN1BKlsaI2iQ74FSqEDwz03LFV/YA knRvmRLEmehEW5JPqo/yPHb/V5/YMUM= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-30-J-U8hY63OK2x724yMy404A-1; Mon, 16 Oct 2023 11:35:41 -0400 X-MC-Unique: J-U8hY63OK2x724yMy404A-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9ae0bf9c0b4so354057966b.0 for ; Mon, 16 Oct 2023 08:35:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697470540; x=1698075340; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pkxXrxFJoOfSag3lJcT86s5RRoGY5wj60RjfYJlKoAY=; b=kDLha7pdMbTRYd9pydbLA1onlGZ55CNn+pK7LyiRGF5YbShm8C0O6EcSE6UCo90+Ar bjFN0czLTkl2AOCCxrlpUi6v+YVxhnZ/p44hRyionEwXLrVgThNj6o0uYzanqUrUqNak ZGplTqOFe0QW7LgntsvQGxH6G55IXTXnETssQ5h/L1W33nX+1Ldyf2nCYWEJZjUiJnBH aif6UWWxVbRaLhosg6RW/EJy8ZRTA5Yy9H4PcgbNswIBjYQIIhHx00E6RlTIMbsqZ4sf 60+aO3yzqFuYbwr2zJC3vBY2lAizM7LiOrhIr4FYjF5sy+kE9H98dAaoA/Wk72xm5kp4 kTZg== X-Gm-Message-State: AOJu0Yx/QaBlS2Y0t5RgVUrc1MBfGWITysUjq2R4vvREa73Klsy3h7uw j41zN0pmX2KswUcrIn7vNxmXo9rp86ieRgSKWI52Pl8p4cpZFU3+kcygAoWSaMxZf4fEaCI834h yoriYEQhKNp7+hEYbvWnHKefG X-Received: by 2002:a17:907:3e21:b0:9c3:c2e1:a38e with SMTP id hp33-20020a1709073e2100b009c3c2e1a38emr3961960ejc.15.1697470540244; Mon, 16 Oct 2023 08:35:40 -0700 (PDT) X-Received: by 2002:a17:907:3e21:b0:9c3:c2e1:a38e with SMTP id hp33-20020a1709073e2100b009c3c2e1a38emr3961932ejc.15.1697470539811; Mon, 16 Oct 2023 08:35:39 -0700 (PDT) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id xa4-20020a170907b9c400b009b2c5363ebasm4245504ejc.26.2023.10.16.08.35.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Oct 2023 08:35:39 -0700 (PDT) Message-ID: <19399d81-d61c-9287-3081-e1da5a833984@redhat.com> Date: Mon, 16 Oct 2023 17:35:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 1/1] leds: core: Refactor led_update_brightness() to use standard pattern Content-Language: en-US, nl To: Andy Shevchenko , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek , Lee Jones , Denis Osterland-Heim References: <20231016153051.1409074-1-andriy.shevchenko@linux.intel.com> From: Hans de Goede In-Reply-To: <20231016153051.1409074-1-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 08:36:42 -0700 (PDT) Hi, On 10/16/23 17:30, Andy Shevchenko wrote: > The standard conditional pattern is to check for errors first and > bail out if any. Refactor led_update_brightness() accordingly. > > While at it, drop unneeded assignment and return 0 unconditionally > on success. > > Acked-by: Denis Osterland-Heim > Signed-off-by: Andy Shevchenko Thanks, patch looks good to me: Reviewed-by: Hans de Goede Regards, Hans > --- > v2: added tag (Denis), Cc'ed to the updated list of LED maintainers > drivers/leds/led-core.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c > index 2230239283d0..89c9806cc97f 100644 > --- a/drivers/leds/led-core.c > +++ b/drivers/leds/led-core.c > @@ -364,17 +364,17 @@ EXPORT_SYMBOL_GPL(led_set_brightness_sync); > > int led_update_brightness(struct led_classdev *led_cdev) > { > - int ret = 0; > + int ret; > > if (led_cdev->brightness_get) { > ret = led_cdev->brightness_get(led_cdev); > - if (ret >= 0) { > - led_cdev->brightness = ret; > - return 0; > - } > + if (ret < 0) > + return ret; > + > + led_cdev->brightness = ret; > } > > - return ret; > + return 0; > } > EXPORT_SYMBOL_GPL(led_update_brightness); >