Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1876063imj; Sun, 17 Feb 2019 17:17:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IaId9ZCdLNXYxZ2IW5OWYnhjDWt8eJT65wZAFzbEpHKHcT0ACqFr/dti07XXlAn7Q+B2+uF X-Received: by 2002:a17:902:bd97:: with SMTP id q23mr5876175pls.210.1550452665375; Sun, 17 Feb 2019 17:17:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550452665; cv=none; d=google.com; s=arc-20160816; b=nwV9v2IoBaMUAFLCn7+q0kqxAmiQmfo5mKFszKtaVFe62VEX6KbrfA0IUBRd0v7CJz MGnjL/PQ5ssKM6QaRlzazMkXk2XLeqnAYzszLjQpl9W5bdwZo/mvKOQPOZe0/8MWVNbF x2jbV2gLVfBlW0pYgJ/UEzgiH1fuN3/OQhKccQVukYEcVNbQXDQFNN8FSI3N8ys4JMFS PHWSEmalUKb65VykluttB9e9ZlHcoQMLoatSMYOFnxmTVDtJOYjh7eciWNvqdieTYsH/ hNAmjLwB08jbHC3u43tsASUViStEYmpB+BjkulMu77bzBlUUW5ifLW6snNCA/Er2c9Qi dn6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=owvyJfv+sLtglQSktBEJUHJGBj7J0e1EVwmJU0yR07s=; b=TKrLZq7+W/fLgyyFyo8e3l+iSwHt40RrRPryxe4InaN/gBK0UFHgBnQ0xwFQVELLI+ veqaiH0H8PfFrk4LZ7V0qQ3rEwsAgjh9ko6Zy+PH+6A+jraqcCHn1HV6WFqkvjM1Mh+r BJI8cZo2YnfJ6C/K1eDczOWbe/IONWEGvWuirnUtu93vzxKLJunegMTmzv2c/5lRLc4w wi3TCYJSOFgOkhMeV3DSmKPAUDxCTZ383XOgkvWoWp8K5OXO8KqA1x4HGDzJlUl1mFBq GM7sIgJkBA+qoW1MWubEcmM3L9EnY4icjvPZkYGOcI3ITW3gtb6VQzY0VaVSUw2uNt+X z+jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf7si4707822plb.33.2019.02.17.17.17.29; Sun, 17 Feb 2019 17:17:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727619AbfBRBRZ (ORCPT + 99 others); Sun, 17 Feb 2019 20:17:25 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:63288 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726281AbfBRBRZ (ORCPT ); Sun, 17 Feb 2019 20:17:25 -0500 Date: 18 Feb 2019 10:17:22 +0900 X-IronPort-AV: E=Sophos;i="5.58,382,1544454000"; d="scan'208";a="8104819" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 18 Feb 2019 10:17:22 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id B4852401A637; Mon, 18 Feb 2019 10:17:22 +0900 (JST) Message-ID: <87pnrp52jl.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Daniel Baluta Cc: "broonie@kernel.org" , "vicencb@gmail.com" , "alsa-devel@alsa-project.org" , "tiwai@suse.com" , "lgirdwood@gmail.com" , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx , "S.j. Wang" Subject: Re: [PATCH] ASoC: simple-card: Fix refcount underflow In-Reply-To: <20190216100927.10017-1-daniel.baluta@nxp.com> References: <20190216100927.10017-1-daniel.baluta@nxp.com> User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, Mark > of_get_child_by_name() takes a reference we'll need to drop > later so when we substitute in top we need to take a reference > as well as just assigning. > > Without this patch we hit the following error: > > [ 1.246852] OF: ERROR: Bad of_node_put() on /sound-wm8524 > [ 1.262261] Hardware name: NXP i.MX8MQ EVK (DT) > [ 1.266807] Workqueue: events deferred_probe_work_func > [ 1.271950] Call trace: > [ 1.274406] dump_backtrace+0x0/0x158 > [ 1.278074] show_stack+0x14/0x20 > [ 1.281396] dump_stack+0xa8/0xcc > [ 1.284717] of_node_release+0xb0/0xc8 > [ 1.288474] kobject_put+0x74/0xf0 > [ 1.291879] of_node_put+0x14/0x28 > [ 1.295286] __of_get_next_child+0x44/0x70 > [ 1.299387] of_get_next_child+0x3c/0x60 > [ 1.303315] simple_for_each_link+0x1dc/0x230 > [ 1.307676] simple_probe+0x80/0x540 > [ 1.311256] platform_drv_probe+0x50/0xa0 > > This patch is based on an earlier version posted by Kuninori Morimoto > and commit message includes explanations from Mark Brown. > > https://patchwork.kernel.org/patch/10814255/ > > Reported-by: Vicente Bergas > Signed-off-by: Daniel Baluta > --- I'm not sure which one is correct in this case Signed-off-by: Kuninori Morimoto or Acked-by: Kuninori Morimoto > sound/soc/generic/simple-card.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c > index 08df261024cf..dc18c4492955 100644 > --- a/sound/soc/generic/simple-card.c > +++ b/sound/soc/generic/simple-card.c > @@ -445,7 +445,7 @@ static int simple_for_each_link(struct simple_priv *priv, > /* Check if it has dai-link */ > node = of_get_child_by_name(top, PREFIX "dai-link"); > if (!node) { > - node = top; > + node = of_node_get(top); > is_top = 1; > } > > -- > 2.17.1 >