Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp335297lqr; Wed, 5 Jun 2024 07:31:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLZMCKWUuiJ3kZy51y+RArpUfdreAPqbANDt2j+pF2h4vrKGPATX75KcSvZmWUFKBL04nD8kfqLk/d85oqompMnR1TxAKwyOiHs6DdoQ== X-Google-Smtp-Source: AGHT+IH4sWNRLCD2apvNkAbjW0hHZjLfSa5WijhnUdW2A1cC9QCnxqe5bmtM901ycjS1xLDO4cdP X-Received: by 2002:a67:be0d:0:b0:48a:2b40:ec77 with SMTP id ada2fe7eead31-48c04122ecemr3183299137.8.1717597862893; Wed, 05 Jun 2024 07:31:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717597862; cv=pass; d=google.com; s=arc-20160816; b=v6pqmYG3SDG9h0+h8zaVkok3yBhsLBEekoSv2HmnCoERQimFhX18JdOIGsyXt2dK6Q dhTveOAIDYt0Pbezs2ZnbZ+ahv7TVByJo19aD4b+bk1J0x0V6ZORG1zkKojs2q2/x1U1 Rg4zfydXnwdhZ2nMIAhwgicHWxYCOqy0A2AieiB6OJS0SvPxfEumvwgKuuvm6pGk1tJN CDqggN7YT+yeNNJcnA+ECDVWe8G0I9y/lat9r2PWasgDuSqIHjd2DLxruIveX9xiugmL 2MoeJ0hOsCrPbV6BqU1BzXFnBQ37w/+MOKSusPi9IVbfmfesfQjCC6nAhyIpzSSp7KtJ HBHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:subject:from:cc :content-language:to:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DguutoWpY2WySE798EOMwqpqzeLAlf2dBu3Ds8nfwBc=; fh=yRGiXPFmfQABgGqUJldUe8L795+wPRWbUt8klZnn1Qc=; b=PvOLQeVbjGOsPWurtXim8SkaJBEC7PmIGgnsnYVsqP+JNiqtt/XctTE5BzjG6ZgAcg k/67ErPY4I7giEIyNkBTg0ugqlAVyRtP7rY336PzaamVWPrfbFYpCklhqFw/gq0KZwTY XoSzmye2X9fVJJ8+XoW4ZKj86BSBVJ8LXASYAIODl1Qeh6oVdQSJ5uUF28rTGRXNm92I M7/tULC7d49bvCvGaAkxwQ5sYtyqOzWp8bXGg3QCgMxWsqTQaF+mA8UqdYGBQA1skyrn 8Tr8Q6ETLtsgHXcH34oLC2DZZObQIkkotjAL0x34zmsqHZMkN5uH4kf3mpIh5aV9vPdc jexw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=LzNxukSl; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-202776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ada2fe7eead31-48bf078d656si1205493137.25.2024.06.05.07.31.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 07:31:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=LzNxukSl; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-202776-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 46B281C2297F for ; Wed, 5 Jun 2024 14:31:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E8851CFBC; Wed, 5 Jun 2024 14:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="LzNxukSl" Received: from mout.web.de (mout.web.de [212.227.15.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21D9E19D8B0; Wed, 5 Jun 2024 14:30:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717597856; cv=none; b=HLOyloTnKkLkfUg0XHngCq1dlJUA/PWnXwYReiejS/oK0ckR2ZhlQV/G4aA3qjPnO8eIBJKXku1PA/9m9/wRjC0+f1Gno3Fw0W1norbtTxY9Rj6wdrKQCzh8BZDO/IcHCnSPAkRr0Ypjh9sRVq4ieY1qgLGiMChGXRYoerSWKX0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717597856; c=relaxed/simple; bh=JOpsxfJ0G6PRdrpIjTZPfHtk3rGETkC0ilV8uhYpliQ=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=Rr1823mdu/G/CYASyhIg0c64hyxPwPK/gzH4bBlB4Elpp2xvY0U/Nd99/o6Q9Nogzr4uZcpFROhQ/YYHZLA8y9+H+aDvPqN/VbIcFT05v/KF3UX+G/PrPE8aIxv+6awXAsmeBjt+2gV1phY9M2RpflRlmkNcSVs1jPsVvqoCGAk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b=LzNxukSl; arc=none smtp.client-ip=212.227.15.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1717597833; x=1718202633; i=markus.elfring@web.de; bh=DguutoWpY2WySE798EOMwqpqzeLAlf2dBu3Ds8nfwBc=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:To:Cc:From: Subject:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=LzNxukSlI60/8bgRUOtU8D+9/hbz8oJ6w6xS+57Y2susjQDPlrHlaStgYLGBunqD 0gdZ78CUAFI+W4JffnsgHRzxkORo8IbMcaPYoGX3t2ngsM3JFFBZ720TYFbealckA ymXLKmq+fF+xkXYzdC0h5Jx9pWVWZJ8XSwjmQcyg1y/Ux8fF5KE5puFaAT7BdTGeD vpgDHaNvjCecXPHa/2NW5fesnXf+hgOYUZIxTyjBdqA9Row6JHLjac0e1+Z/pCzl7 ulbhwvy11zmlxlJRSOKfTSIcMt2z4QJyd0m0SeAGQaz8R4w5Vsv9qUvoGBgBg8MlQ ROCEggsB/20qqi/r8Q== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.83.95]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MsaS7-1sZZ2J49ut-00zl1P; Wed, 05 Jun 2024 16:30:33 +0200 Message-ID: <5faec5de-fc36-4b38-abcb-c61954a824cd@web.de> Date: Wed, 5 Jun 2024 16:30:30 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: linux-leds@vger.kernel.org, Abdel Alkuor , Lee Jones , Pavel Machek Content-Language: en-GB Cc: LKML From: Markus Elfring Subject: [PATCH] leds: ncp5623: Use common error handling code in ncp5623_probe() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:e1+zSS4wCoISuWGaAP+d+ZLAcyOksWJ4oMLJzX0TPpZZnhH1sO4 LpDiymvvmh5fczrDXFJrtfoZHoJfk90Rdq+GXiXIXGCLbCA9N/l1YzQwlc3W16fNoq7fdMt WlQmTW1t0lT+XI7iUfEj5Ws84xlDVaTaTZSubFhMmjzKDgcojYYpP6vDd3w4rkeb6N+YSop 691Xu9AEMcyz1GzyaTLsQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:AdsUg9cqJ0o=;KHrT9osVuRknSYLeFse7SxoDWM5 3Qwwwf9wx+xLZ+Vw1C1hJ4zYyAk4RXIgAZ75UMLQXl7GWOm0r2P38yoo7I747tnKDSl2MKwDe rq5Ex8mnOht5lqpFiLE1B/+bS5AAo/A1XaNEsDmD21oLXPbWs9VsLQmJc1nb+xeFSnUE9ChUH QjAviQ1Kiy83++eFGGNwa+fjRThsrtHf3/AtYu+QVwx9/u/KIyu/wZyQ931H/6V2tgyZhGKPK svLXshr2oeC3Dia70rCzo18vJug0dbgY7RBhGkgbqre+FqLRdqn1Q3RgNtH1Pw4HIA82q2ZpY I198t5XcS4bQdIDzdB/ay+EZbIr6+GpSCCdEr38wI7WZmh6tvWo7Wwlk45iv2KEgUI7hYX09f +aeDG6bE5se3mq7UoxdZgdgaMTGAYoc1+SDKUxCgIC4ibRoNv60WWeSX6qFnHIo6Vql168lv/ tGX6BtSdB1z5UZHryVTJ+VqC+h1urIGu1oq+bm8DsRLk5X2uqa3NNaRybY7hfPKbgvCFJxJKd Zji75ESHeTlf/t14OGZG4YxInxClexGAhAVUwSFa/AZjFbwa0xkMVQnVFhIEJNnjAvpyUoiZc AI3973Ixqh8vqHzacYo2rxPDj+bqJAO50PBZsO0n/jj7N5DqW7R++8cBTu9jtDUJ6inaRrid0 9CuvqTlb+5sFRXEzzgPegoCLSYWZKFLvb12Ge/sUWE8XptYaBVUcD0JSrn73uKc5xQ78Dwvkl j8fGwdd+eZTxOuO3pV1elxdpZywrvvwQzug3cDiTk52OQojrostspg0HPuuCHCe34vG+Qp0cu VDQUQ/RLlSIRDqki9+1QN371F8p1YXsguuY+PgTDf77DA= From: Markus Elfring Date: Wed, 5 Jun 2024 16:19:26 +0200 Add a label so that a bit of exception handling can be better reused at the end of this function implementation. Signed-off-by: Markus Elfring =2D-- drivers/leds/rgb/leds-ncp5623.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/leds/rgb/leds-ncp5623.c b/drivers/leds/rgb/leds-ncp56= 23.c index 2be4ff918516..f18156683375 100644 =2D-- a/drivers/leds/rgb/leds-ncp5623.c +++ b/drivers/leds/rgb/leds-ncp5623.c @@ -183,16 +183,12 @@ static int ncp5623_probe(struct i2c_client *client) fwnode_for_each_available_child_node(mc_node, led_node) { ret =3D fwnode_property_read_u32(led_node, "color", &color_index); - if (ret) { - fwnode_handle_put(led_node); - goto release_mc_node; - } + if (ret) + goto release_led_node; ret =3D fwnode_property_read_u32(led_node, "reg", ®); - if (ret) { - fwnode_handle_put(led_node); - goto release_mc_node; - } + if (ret) + goto release_led_node; subled_info[ncp->mc_dev.num_colors].channel =3D reg; subled_info[ncp->mc_dev.num_colors++].color_index =3D color_index; @@ -223,6 +219,10 @@ static int ncp5623_probe(struct i2c_client *client) fwnode_handle_put(mc_node); return ret; + +release_led_node: + fwnode_handle_put(led_node); + goto release_mc_node; } static void ncp5623_remove(struct i2c_client *client) =2D- 2.45.1