From patchwork Mon Jan 14 23:36:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 155593 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4242106jaa; Mon, 14 Jan 2019 15:36:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN7sRZt9/8Jto8oSysgXAZqgrqit+IWXhMeLZJ5vF08RH/oQ/7na6eK9djd1Eeo7ABn+hakt X-Received: by 2002:a5d:4652:: with SMTP id j18mr646169wrs.279.1547509019446; Mon, 14 Jan 2019 15:36:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547509019; cv=none; d=google.com; s=arc-20160816; b=iwadfz+Q4I73MHhBe7ahpW+PuvT3/ndArLqz2ZEuOMwMNqEfbNUmfCu/E4wnEHqBh4 Ea2hlZzrexO2lwZK/QrL9ui2QnwoA9rMvTJKM9HSWCRiMKZAwerNjYmZUHlK1ja+sTfW CQez2TSl9WHb73a2/dMdFj4QgLrOhFoGhGG6xC8BPmBR3noazVWp3EF4OK4ask8yoLMP MK6b95XafSDxji2dSTfalh6MldfWHGt7HWx1Yochx2Rl9j2Q1mzcsN8xyxBXfaUcEjtO f1Vvcy5pgo40snaQ1JfpBKS6wl+7cB90el0xmArcUyvh56W8M4O15kNAnRsIzsjdv2sr M6mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:dkim-signature:delivered-to; bh=YE8Rl6D/juXJX2WH3V9T5EcAgR/HQn8/DQ4pIFUcsxc=; b=OByA07211rdZNGRdk9gsPsem4qi7ZKEJKAN+oQt2E3Jq4SsSQwmQCYLc2df1dtP1WD WW6yJA8FS3OqvSkyneF7HhJCzx3yOv+g8cV4uVFW48MFYPjiVKjDUYxYjoEjTkAtM+qU zwUlVyZyHRYVQr7nKCYKHBUrMC3EXOhoSRi72muk6FcC8E1OfN2rPzjO+GcdSkiD2WJD fVlzSaTG2c5q2ibb2tPIdODa9ptONk5ZM1k4wTWmXDBmPrRMvV0nAYRqBPgVMAlEzBuB P+FpvI7KKE+UtfEibWg+bC4rCg6xz28XA2d9zqn6SmXDBC3/XpZQimHGHhIlJNV90+Dk t84Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=BXUm+oW8; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id n63si18976091wmn.178.2019.01.14.15.36.59; Mon, 14 Jan 2019 15:36:59 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=BXUm+oW8; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 824CC2670CD; Tue, 15 Jan 2019 00:36:57 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id F18FA267128; Tue, 15 Jan 2019 00:36:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 22F2C2670AC for ; Tue, 15 Jan 2019 00:36:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qhdOTLMyy2NUWPeU0ujY3tkbPqJusO88j1Gy24nZLlQ=; b=BXUm+oW8RJ8iOfrjfotYTvmXZ 6SqSi5fKKuK9jMtP2rLIf97sikuJjzu4bssq6StommDKUP5zmemu3LcJ9oOGGePF2zpllFkLhr15c Q8+e3xWLPU0UppTAhOnquL/6g574+4K6XiEhk2RHf+6zxgX6ZWIma/o5/rsA9W3WfFe9g=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gjBmi-0000g9-Pq; Mon, 14 Jan 2019 23:36:48 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 55B321127AD1; Mon, 14 Jan 2019 23:36:48 +0000 (GMT) From: Mark Brown To: Rohit kumar Date: Mon, 14 Jan 2019 23:36:41 +0000 Message-Id: <20190114233641.13375-1-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: rohkumar@qti.qualcomm.com, Pierre-Louis Bossart , alsa-devel@alsa-project.org, bgoswami@codeaurora.org, vinod.koul@linaro.org, plai@codeaurora.org, Liam Girdwood , Ajit Pandey , Mark Brown , srinivas.kandagatla@linaro.org, asishb@codeaurora.org Subject: [alsa-devel] [PATCH] ASoC: core: Make snd_soc_find_component() more robust X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org There are some use cases where you're checking for a lot of things on a card and it makes sense that you might end up trying to call snd_soc_find_component() without either a name or an of_node. Currently in that case we try to dereference the name and crash but it's more useful to allow the caller to just treat that as a case where we don't find anything, that error handling will already exist. Inspired by a patch from Ajit Pandey fixing some callers. Fixes: 8780cf1142a5 ("ASoC: soc-core: defer card probe until all component is added to list") Reported-by: Pierre-Louis Bossart Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index cdcc417c94ca..b680c673c553 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -742,7 +742,7 @@ static struct snd_soc_component *soc_find_component( if (of_node) { if (component->dev->of_node == of_node) return component; - } else if (strcmp(component->name, name) == 0) { + } else if (name && strcmp(component->name, name) == 0) { return component; } }