Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp197971lqs; Thu, 13 Jun 2024 07:48:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqea0VAuVv28fwC7I1fMzQLIdEUG5qSKM1XwEv2lMiG4bY7+V7Iv8QsLvZuZWvNeWWLKAFHH9XxhwlswPckoIy/ktrgWzB+PxhiitLyA== X-Google-Smtp-Source: AGHT+IHAUcNMDOC11g3QuWx12ItDCRnMy/JWdD0Jrt6hA9bumVj4mDdUvKdSM7HSJpcrYPadEP70 X-Received: by 2002:a05:6358:491a:b0:19f:174c:7fa0 with SMTP id e5c5f4694b2df-19f69d8b87dmr554960655d.24.1718290109170; Thu, 13 Jun 2024 07:48:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718290109; cv=pass; d=google.com; s=arc-20160816; b=otnibaSWAiSmBga43KVbDv9M09PQxvmcxENUbA9rSM1Vi2ttDgtiXhz04vUxAxF6u5 g4MtFLSBSdhEan/qFVAGTvp0/R65SHY8vXr/jKgRpBX3ObIdVn3rfrQ9RJThC1FWFvnZ 7GtAmmzQ68xuRqB67OBHwuq8Rs6596s8cke/x4B5bpIo9nVcMlHNGWDLyiOpzmSsYD3Z mzRmkpjzOsSwr0y6lLKmkcKTDSggvrwnBqQEyoCUS3roLUZnWWv4zYWaZsr+Z7y+ywUx TUK1YwE+G49/VMtVO0YlzWBn8yFDXx0nvJeddc8HZ3OpMDcp+vnp6a6gf3bp6UVTJGIH i09A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1MCoRRvTO+1QlMOeRdAKtS2b1M0+xTMUMaq/uigTTA4=; fh=jKr9YQBxof9XWDbyHsZ++waEydTqWsF+ypK8RLa/dX4=; b=x907+WRFMJWWssaAbHSEYuB+9/XCxx9YjfsKCrxlFLjcrlGr0tXJ/teC0gOFM9OtQH bIgZyVV1P7giwjUaf505PyzA9KnkTJhMIWf6voakY78hHNrUdwmG8kS3W4BYgH76EmsZ 47LCfRzKkNqip2KbLzzgra9X1PrXfkrWwVLWCrfDm0XDiDpwfCa9fUbwo3mEuBqTbOP6 iT+wmLm1hQEUtFl2EmMpyw9MTzfKmUw6djmj9D5r/Nu7vEdrhbT2zlp3hzwzc5B/tw8l 39yNWXsaW2SnhIY6yJuIov3zE+v7bJM6PFqkfQWJ677VIzqqzynqTgHWMzW59eqokYHM kumQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d2lu45o+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-213456-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213456-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee61fa85asi1534135a12.781.2024.06.13.07.48.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 07:48:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213456-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d2lu45o+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-213456-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213456-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 75B61285306 for ; Thu, 13 Jun 2024 14:47:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 84692139CFE; Thu, 13 Jun 2024 14:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d2lu45o+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ABD7512C528; Thu, 13 Jun 2024 14:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718290027; cv=none; b=a//e2RUNG4dbT45MUbI1tUNy5aWeNtktebvXTCafVFZrP+a2XVQoM5RILDyWGpjvQVnQBrFrJUaWdMQJzt8NP3lnTd1sfC0eCZZ99ZmV0jfEh+pp6noKjyW4kpWPvJGRSr9IBCFEHDmzg6LV5mi/Yg5AwpRlIi87tAklOojekho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718290027; c=relaxed/simple; bh=jK2gdUjoj+cRxhdeg1jZhUoCifthBXqPUWejNjj10lo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CVX8M0CPxldZ92nGgA4AchC9sD7rinW5LhVk+MdPL6uWVdh9DMi1MwpX39bklSYeJuCtXGWIB4+IM4RYL4zwnucZUZ/jUU7kqSxAmGxJyl3Yirb2z/ft26DL28dqRrNZ4OujQC9wnEJmP1ucayrmCWH4PB9+BEDNF3KIhAdkcFU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d2lu45o+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16AC4C2BBFC; Thu, 13 Jun 2024 14:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718290027; bh=jK2gdUjoj+cRxhdeg1jZhUoCifthBXqPUWejNjj10lo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d2lu45o+Ydw/jwlGxUhNdagLzTCqMGvgZd941PPMvvteZ/RajSIUxk7FJmLFDObr3 qbZ9QyJtSMHJPIchfTnzuXBhgtArPmUK0cQJMJt4RdTNVDAktbNW7PmL0zUzmTVeoT oe8A9WQgjwavflaTb0RXNfK+1/qYAJMx6DSd4zBED+fHvqdgExsQBTVX9Pgy38ynNm FaADpUWVNR6cChGRf/XQSjgZc0sQeX2xw/jcxl2+v8ITNjVOmiAZ+vGzbIJs57TJRc gcJsOFiIbKHmpORDouMn93VI1TFlDO6et+ruxgKor2SEpgY4h/0LLT74SNUiO+65oG X7yCt2z4yfymg== Date: Thu, 13 Jun 2024 15:47:03 +0100 From: Lee Jones To: Markus Elfring Cc: linux-leds@vger.kernel.org, Abdel Alkuor , Pavel Machek , LKML Subject: Re: [PATCH] leds: ncp5623: Use common error handling code in ncp5623_probe() Message-ID: <20240613144703.GH2561462@google.com> References: <5faec5de-fc36-4b38-abcb-c61954a824cd@web.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5faec5de-fc36-4b38-abcb-c61954a824cd@web.de> On Wed, 05 Jun 2024, Markus Elfring wrote: > 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 > --- > 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-ncp5623.c > index 2be4ff918516..f18156683375 100644 > --- 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 = 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 = 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 = reg; > subled_info[ncp->mc_dev.num_colors++].color_index = 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; No, we're not bouncing around the function like that. Only use gotos to skip _down_ to error handling code please. > } > > static void ncp5623_remove(struct i2c_client *client) > -- > 2.45.1 > -- Lee Jones [李琼斯]