Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7151960ybi; Mon, 8 Jul 2019 15:41:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9Btc1DR/D07rOftEsli1BcW9qMnPW4i1QrXvaKlZIc5LoPw35yoBZdew0cNYpTy478Lrs X-Received: by 2002:a17:90a:ad86:: with SMTP id s6mr28722663pjq.42.1562625701857; Mon, 08 Jul 2019 15:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625701; cv=none; d=google.com; s=arc-20160816; b=BY2TZykl6Zxy3kSNiCwmqAstHMJdLxI6z3BxxKSueBBcYMhrBdX4Zx7ThxbWsNFxa8 Qfif+AbV8rMq4sBNA9SNqeXeTscMXparz3WUDbfmXmKBb37iWF2Z4jc3ukyNHfvHXDqS sQt+M3tHW7CjxKK2UZ+AJeAqp5Imgr/nLJmBumdLikxIN2xXxK9VIC2dRkBFhlRUTWqb NrKXfK9terZLADF9gMvpYKdrw6xs9DvR32u0DkT1oC5a9LljRY4bDC56e/rlIo6MUm6W qyMeshRcRw/6/9WmmONEWievgduJmZTC0xvbCsz/ng3W5rhffanLOSvkUKOKiTNlKZqd WKmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Bmt9W5gAv+BhUzWvU2t65jMaJbJbDGDyzf3/wvM1ceo=; b=pdZemB2PqSSf1c3SNesVrGAjBWpXldp5jvObSkC5aAx08Pr4LxozazmX9oPg64Jysn f2kwc9wXAMc2JwMdxOGtcLgjbnYPqb+jC8E+AUe/IAdreI9zEbSJsCrwZOZxFSekL0Mi HuoDtAGmjWFqBT3oq1yGvD05No9lE9DUtFz3TpunKFIpar/tRUUdYwzFy+1rD95rPZpK aEiA15z3ZgmLZ5i8wAGW1lQKf7uLUKOSkGsU3dwrEOEYkRH6aftIDrU+q2RLmlS1sXqL kmk810it4WAS0HJs3UqCr2Wi+ZsPAj9+fHh+ve1TrBwnzU7bfxO067m39DDc4r3JtbZU 6MtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=niCAQtHO; 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 x24si21518903pfr.200.2019.07.08.15.41.26; Mon, 08 Jul 2019 15:41:41 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=niCAQtHO; 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 S2403770AbfGHPly (ORCPT + 99 others); Mon, 8 Jul 2019 11:41:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:53542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388681AbfGHPZ5 (ORCPT ); Mon, 8 Jul 2019 11:25:57 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 82A7621537; Mon, 8 Jul 2019 15:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599557; bh=W/DAjNNxoBzT4QdAtfDy6YR690r3niWotcxD+ROVVzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=niCAQtHO3y9p8ZdlenstATvKJsCwvgZCuNglt4EWuNCMyMbF+RXjAMssSe7ucZsPs ty0aipvDjdR+3cmxdL6s7hJTJ4Kfb1qj9vizwy2w9bohXkATar3gA4SnFcQx2Md/tY gwV/lprEzAYvZ8eYZzSHekjt5txfU3J4lXMnBB78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Mark Brown , Sasha Levin Subject: [PATCH 4.14 13/56] SoC: rt274: Fix internal jack assignment in set_jack callback Date: Mon, 8 Jul 2019 17:13:05 +0200 Message-Id: <20190708150519.479345997@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150514.376317156@linuxfoundation.org> References: <20190708150514.376317156@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 04268bf2757a125616b6c2140e6250f43b7b737a ] When we call snd_soc_component_set_jack(component, NULL, NULL) we should set rt274->jack to passed jack, so when interrupt is triggered it calls snd_soc_jack_report(rt274->jack, ...) with proper value. This fixes problem in machine where in register, we call snd_soc_register(component, &headset, NULL), which just calls rt274_mic_detect via callback. Now when machine driver is removed "headset" will be gone, so we need to tell codec driver that it's gone with: snd_soc_register(component, NULL, NULL), but we also need to be able to handle NULL jack argument here gracefully. If we don't set it to NULL, next time the rt274_irq runs it will call snd_soc_jack_report with first argument being invalid pointer and there will be Oops. Signed-off-by: Amadeusz Sławiński Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt274.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index cd048df76232..43086ac9ffec 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -398,6 +398,8 @@ static int rt274_mic_detect(struct snd_soc_codec *codec, { struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + rt274->jack = jack; + if (jack == NULL) { /* Disable jack detection */ regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, @@ -405,7 +407,6 @@ static int rt274_mic_detect(struct snd_soc_codec *codec, return 0; } - rt274->jack = jack; regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, RT274_IRQ_EN, RT274_IRQ_EN); -- 2.20.1