Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3124273rwb; Mon, 15 Aug 2022 18:43:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR50rudjnfSfwRWX9luG4RYw6LPdpNnEldRV5m/hVhSszA3ElrElx/tYojiK34MZu6hHoQpG X-Received: by 2002:a17:907:28ca:b0:730:aabe:2e28 with SMTP id en10-20020a17090728ca00b00730aabe2e28mr12094392ejc.72.1660614233958; Mon, 15 Aug 2022 18:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614233; cv=none; d=google.com; s=arc-20160816; b=Z6ikYHFJn6Q8Gn+8rX6nlH9S0hb2c4Q+CSNX6oDuBdrZE/Gwnb87UfIiqzLWDGhLfW 6U2Ho42ngdRkCQmBtQ4R/WuOad08HMcPuncdWxppjY8cR2eiwSBDtKi+7TC78ZVPmIaM b9EmZm3WHI4QkJxRAqd4U/MLchmg3p/GA6dLUogSvo3Dd/KnrwFwhpiqIy+C020dRmOF VpIY4JRXA23DecGElDs0PX2mfBiDVmh1Ptmg4yYUpGbSGk3Tj/1zG5Pah2h2wwkoOLBU Qxnt8oUQ5ppcD/2Zulvw1zSQzQn/iorVX/aDXjPRmAShyoTTTObsHiAAMuz54voK2zfU CJJQ== 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=bvn7ORaezq1hDhlXEujg6uXUIhxguT6fhhcDINy1nyw=; b=pC/zcyZGVEdFLuOcTIrdWDpyiEZzFrCEXCotfznho7F8ku7TKydiW930YU9o2P8ijV EdvQndJuYh8i5ow/n4nT6xsnc+zrCSpvDt9iQh5RBNc0D9zfwDWokl0CdOjPeauLPYfB p8gVeq49oLQbt8p450ZC1ubpM/y9UvNlIyuUGNpWxKuzPHgfxKXhjDfDq5n+SD09PPHD WUqdbAekV3XoetZgT8mtxY7WMEyAvjQ0lJ95C87n1pKHWvEyeoyISvNWxoBWVhfZLSBE sWjCpKAi36L9OyXFCVWO1OaEx1pJQUZ7etTWPsYWnlZl9UtVbxCr9j1m01YfsJ3R7lOE PqiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZcSwslqt; 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 s8-20020a056402520800b0043bcb2650d9si10352846edd.42.2022.08.15.18.43.28; Mon, 15 Aug 2022 18:43:53 -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=ZcSwslqt; 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 S245133AbiHPAhZ (ORCPT + 99 others); Mon, 15 Aug 2022 20:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344061AbiHPAek (ORCPT ); Mon, 15 Aug 2022 20:34:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D567B187FBC; Mon, 15 Aug 2022 13:37:23 -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 8FD70611E2; Mon, 15 Aug 2022 20:37:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80D1EC433C1; Mon, 15 Aug 2022 20:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595840; bh=zKoOUGLc9GCXGCCdM2OM3y02a5kExyeYGGHCHrGuQzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZcSwslqt51fB5uQPqo+DYSkeR31tjax4FMFeyQQAWbwwMWSOMt1ub1OQXFNLBP9jO 7cX5ExnLMmjqKOUo595F/TMvlfYpAtJmbwsKL/faQ/v4pq5SpusLsdKnfQccCNI/ye FiLXU7c8qyt/9DL7gr3zkkLTj/4sVBZbQcMQVRVU= 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.19 0891/1157] ASoC: samsung: Fix error handling in aries_audio_probe Date: Mon, 15 Aug 2022 20:04:07 +0200 Message-Id: <20220815180515.081357047@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 bb0cf4244e00..edee02d7f100 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