Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9083431pxu; Mon, 28 Dec 2020 06:14:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzOwCFIcAAOJmTnkh0hoyMH0ErjYZggYcexXx5mg+OlE5Z+Vc9p7B8VyrFagsi46v0oJvu X-Received: by 2002:a17:907:435c:: with SMTP id oc20mr42602793ejb.286.1609164849855; Mon, 28 Dec 2020 06:14:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164849; cv=none; d=google.com; s=arc-20160816; b=HLSDPVYa2CRZ0FvMEdqNDhLR78abtIL5I7B50JDGkKyk51cqnXtrqv2f/rJp68TrXT LJeSJvm2Lr/Ns/IRlZiQvQ5gXUg5FUddcb8a21/1KzZaYp5cQwLtddjMmYCH09z45iMt ioaAlHIr396ink/MkGAm1YwlEbd+bbEhVGaUkYSYhaclCAe8oSjDU67kMYBMU0/MHZt2 XKa5UTTBIsNCWzPQBvpvjIMM3KjE5Pk9NzNr6HpsEbZ/7aj2SL9LjViJJgzRnVB1yjdQ Ycxc0OPewEpKhTtyj7z6hqSoS5jgDRlvwX72LghJEL6Bm81h+WbXBMB/Kdvr1o2DPfQc Sokw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VZ/fAYPBWMRjawYqSkSCGXoEsnX0ukKvoyFZjjqWR6w=; b=hUSlhBJpr1nPNtOptXcY9+VkovcaBQxvR3VoNmymqNj64J/vKDYplgXoHWo/+ZTx2a l9MyMb5yzgKpi9KX/AqlpKwJmpEo5RMBSUXlWdzRhgmlYm1k0iws4nPJ3lKdeemnjfVe 5sZObDAT65hDSIyl/p+wl2GXHycIgOKdYUw8yYBEuaa2UiEJnoMN7FYgTPrWuLOL7AFq oPcR/83pdubKh0UV79F1Zbu01ibQa6jz+Fw887HA+YHHv1Gcro0CeVTBodMN1ObJzApW RGg1jp82UDi5VyxghpXFmcaCTRoh7tvl7Jr66R3VeycWPh+kPpIb0GM2ke3jpkhjlkxA TAVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="l31Z/3Ib"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 97si21064428edr.112.2020.12.28.06.13.47; Mon, 28 Dec 2020 06:14:09 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b="l31Z/3Ib"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438750AbgL1OI6 (ORCPT + 99 others); Mon, 28 Dec 2020 09:08:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:43244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438717AbgL1OI5 (ORCPT ); Mon, 28 Dec 2020 09:08:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D9D2205CB; Mon, 28 Dec 2020 14:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164522; bh=IWlUGcXcpSqxeRF9LeGhQQP2euCF37w8cNULYYO1ozA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l31Z/3IbJ7sONsrc/9lH0Uh1ZIfamUXW9cc6cf/tN77DEmDwcqnx0akc6kpkdll6J Iyl3osUMmpJ4/hEkCW92KNuN5tS+mSnidEes3hMsP0NGcywMQafP7AgrFIRDlA3aCM g5YxLtpj2hdH9RWErW917qm9YPdtx6WYs1xCLtMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Dan Murphy , Pavel Machek , Sasha Levin Subject: [PATCH 5.10 204/717] leds: lp50xx: Fix an error handling path in lp50xx_probe_dt() Date: Mon, 28 Dec 2020 13:43:22 +0100 Message-Id: <20201228125030.755655060@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 6d8d014c7dcf85a79da71ef586d06d03d2cae558 ] In case of memory allocation failure, we must release some resources as done in all other error handling paths of the function. 'goto child_out' instead of a direct return so that 'fwnode_handle_put()' is called when we break out of a 'device_for_each_child_node' loop. Fixes: 242b81170fb8 ("leds: lp50xx: Add the LP50XX family of the RGB LED driver") Signed-off-by: Christophe JAILLET Acked-by: Dan Murphy Signed-off-by: Pavel Machek Signed-off-by: Sasha Levin --- drivers/leds/leds-lp50xx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 5fb4f24aeb2e8..f13117eed976d 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -487,8 +487,10 @@ static int lp50xx_probe_dt(struct lp50xx *priv) */ mc_led_info = devm_kcalloc(priv->dev, LP50XX_LEDS_PER_MODULE, sizeof(*mc_led_info), GFP_KERNEL); - if (!mc_led_info) - return -ENOMEM; + if (!mc_led_info) { + ret = -ENOMEM; + goto child_out; + } fwnode_for_each_child_node(child, led_node) { ret = fwnode_property_read_u32(led_node, "color", -- 2.27.0