Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3013932rwb; Mon, 15 Aug 2022 16:09:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VVVNP+dUJNX6+V1CI2DBnOIQd8PhFnz2sb1ENJvAhqSKFiHkss1jHsfKNg2Tv6SkHVRwC X-Received: by 2002:a17:906:8a49:b0:730:b15e:f8d2 with SMTP id gx9-20020a1709068a4900b00730b15ef8d2mr11457184ejc.694.1660604986586; Mon, 15 Aug 2022 16:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660604986; cv=none; d=google.com; s=arc-20160816; b=B7ymWFkLUwV9v/qJa/VUjRHFtMNAgXKwXEdCTqfIdxGxaLp/UDrjQ7hZTkOl+SCrbS nWpk03ynt3RHahKonYJpZpl2OAnV+ApT5rqYneiha8KY09OQBGKDh++LakluTDmFmsj3 yuJHDsTiEPldF7ofTnmX9WbGEFsywUUk3eYpBRMUwR3G1DAETKLhlN1r3xsy2TAXre+8 Q+WxlA4pCu0kWUqvZKLi+t1PGXcDSG80cOtpfZXmPOlvCBqknGRGJZZ63prXBIzqS/eU SKrN8z3AfibH4WwzMAuaaMsD7o7tTaPvUuVDSL/LtkvfFqvkPvcn0o/EstiL2PsN6/Xw CV/A== 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=sK6V0+Y1SUiM5/iU+qA+vY84IWqvgsS3MSYkScp9w+w=; b=xZ1BHV0MaazHFONLl2zy2pueMRiO3bjPd+itisK4XkXPonatii0BDFYZtF94i0jm1W o2fh7KXiaKyEIPJEL4Q3+V9rxD19rN30vNtzq6iBgdBx5b/E4mKNmN/fVZR0oQfa3Trc v7P4EGcKRAH8T4aEiAK0yOGIm8pMieRwQM34iVWBDd6Xthnr1saEJKy8VPb96DkZ9GBQ b2Ws1b5BRFMdLEc8sE4R0AvbjurrHhceLioE1ERbQKocz9P7IesyTPrAC+jQikrjp1Q0 nBQj33rq+2jCsDiOEZEOZjn5ZQSwGU08R2mutoI0efhABwstZZG3LvL2tXo+SGmwPa/c IrHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E4KjQHmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du7-20020a17090772c700b007310a8a411csi8759700ejc.843.2022.08.15.16.09.21; Mon, 15 Aug 2022 16:09:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E4KjQHmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1349004AbiHOWev (ORCPT + 99 others); Mon, 15 Aug 2022 18:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351055AbiHOW1b (ORCPT ); Mon, 15 Aug 2022 18:27:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BD2E6D56E; Mon, 15 Aug 2022 12:46:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CAE856122E; Mon, 15 Aug 2022 19:46:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8139C433C1; Mon, 15 Aug 2022 19:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592794; bh=pqbpWM0ovuucZKEV5C40+B3/2rDpOTNZlRfpRdD2Tu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4KjQHmfE/LN1mUkgOjvvnPrzPfx9nduQJG8RD9RsBZooxC3bsrzxHGZYxSb0MDQF lYfj8hy1yFtS4jv5fpfxG4Hu/eDnYi4PPRUqXRSdADHgEWGPPPciALUnW/ojoauKBx cTcthegTaUdxpzYEY+JnxiuOT3O64sH0zxdszQ6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0828/1095] ASoC: samsung: Fix error handling in aries_audio_probe Date: Mon, 15 Aug 2022 20:03:47 +0200 Message-Id: <20220815180503.568896056@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit 3e2649c5e8643bea0867bb1dd970fedadb0eb7f3 ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. This function is missing of_node_put(cpu) in the error path. Fix this by goto out label. of_node_put() will check NULL pointer. Fixes: 7a3a7671fa6c ("ASoC: samsung: Add driver for Aries boards") Signed-off-by: Miaoqian Lin Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220603130640.37624-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/samsung/aries_wm8994.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/samsung/aries_wm8994.c b/sound/soc/samsung/aries_wm8994.c index 83acbe57b248..a0825da9fff9 100644 --- a/sound/soc/samsung/aries_wm8994.c +++ b/sound/soc/samsung/aries_wm8994.c @@ -628,8 +628,10 @@ static int aries_audio_probe(struct platform_device *pdev) return -EINVAL; codec = of_get_child_by_name(dev->of_node, "codec"); - if (!codec) - return -EINVAL; + if (!codec) { + ret = -EINVAL; + goto out; + } for_each_card_prelinks(card, i, dai_link) { dai_link->codecs->of_node = of_parse_phandle(codec, -- 2.35.1