From patchwork Wed Jan 8 11:50:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 11323387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C60E66C1 for ; Wed, 8 Jan 2020 11:51:27 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D0B02075D for ; Wed, 8 Jan 2020 11:51:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="TUADShVX"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="BAGd9+Gp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D0B02075D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5EDCE171B; Wed, 8 Jan 2020 12:50:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5EDCE171B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578484285; bh=o3upuEFLMKjmDc45dbUO4zO8mfiNViMU5bp3W/WiNHM=; h=From:To:Date:References:Cc:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From; b=TUADShVXPaM6I9RHBPuV+i5CqAsZYgkJ78fPDtF8Im1/OEKY5iWC0ahW89dUWaSo9 R1UvR2WdapzgSWZuauIhBlQ+XfxFnsq2CRRFK4OwQQyCph+AGszw/9lDIr7AGFil0k atZw5lgHfQ/U44JZ++4VcadE/atFCoODYKV+dfZM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9DB61F80149; Wed, 8 Jan 2020 12:50:34 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 08521F80161; Wed, 8 Jan 2020 12:50:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2D318F8010A for ; Wed, 8 Jan 2020 12:50:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2D318F8010A Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="BAGd9+Gp" Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200108115027euoutp0141a06d3e359cda322994782d3b7a793c~n5wrFFT4y0543405434euoutp01H for ; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200108115027euoutp0141a06d3e359cda322994782d3b7a793c~n5wrFFT4y0543405434euoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1578484227; bh=3OyRPuFqCIRdzwH2FYDtdhnfPsBECJGMdvkxFH7m2yU=; h=From:To:Cc:Subject:Date:References:From; b=BAGd9+GpbtxPozyM4oukg80FyFdXjt5mYG6eW4cftmjYb2L/0Xw4m15L2bNdqjZnu //3gnXgfcuDsC1iX+DUBuDDG4xf3DuokfQ5DP6fZP6cIlFl7BbdQEss0dl2vpLmaDH ijRa5fPOe/voAuA9UPYvZiQeKI2Ghqx1jK6MzR/w= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200108115027eucas1p2d11eb4dc1d466e7dbd0b1b36075e8d9e~n5wq0UHpk3212532125eucas1p2k; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id C6.03.60698.302C51E5; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200108115027eucas1p2abcd40e359e993e5b471229b02b69fc3~n5wqaRcR22915229152eucas1p2G; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200108115027eusmtrp28c6e206ae88bd77a88adeee8520cd1e0~n5wqZmVEb1831018310eusmtrp2Z; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-23-5e15c2035f05 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 5E.A4.07950.302C51E5; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200108115026eusmtip16de4a492f67213a17e0ad1e60bd5ff50~n5wp4ZlIZ1983219832eusmtip1U; Wed, 8 Jan 2020 11:50:26 +0000 (GMT) From: Marek Szyprowski To: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Date: Wed, 8 Jan 2020 12:50:06 +0100 Message-Id: <20200108115007.31095-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42LZduznOV3mQ6JxBrfXKVpcuXiIyWLjjPWs FlMfPmGzOHG4kdmifWYHo8X58xvYLS7vmsNmMeP8PiaLtUfuslscftPOarHn4it2B26PDZ+b 2DwWbCr12LSqk82jb8sqRo/Pm+QCWKO4bFJSczLLUov07RK4Mrrab7EX/BWsmPWhmamB8Sh/ FyMnh4SAicTjB7vZuxi5OIQEVjBKLPjbxwjhfGGU6H83ByrzmVHiYvtGNpiWE3c3MUEkljNK /DgwgxEkAday8q4KiM0mYCjR9bYLrEFEIEni/ILbzCANzAKXmSRWN/YzgySEBeIk7u9+ANbM IqAqcar9H1icV8BW4trXjUwQ2+QlVm84ANYsIfCZTeL09qdQZ7hIbD2zggXCFpZ4dXwLO4Qt I/F/53wmiIZmRomH59ayQzg9jBKXmyBulRCwlrhz7hfQJA6gmzQl1u/Shwg7Siy4vAssLCHA J3HjrSBImBnInLRtOjNEmFeio00IolpNYtbxdXBrD164xAxhe0jseb6NBRIosRIzz75gncAo Nwth1wJGxlWM4qmlxbnpqcXGeanlesWJucWleel6yfm5mxiBSeP0v+NfdzDu+5N0iFGAg1GJ h/fHYpE4IdbEsuLK3EOMEhzMSiK8WjpAId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rzGi17GCgmk J5akZqemFqQWwWSZODilGhhr1/0Qdt/nnxaxRP6Z9Kfzh0r/5DgrvUo4orD6aedmjm/q95LV 252uMJtHdK6q0jywrJCr6WLt9tIF3av2iH2bc3RK1sR9HyLX8Ha2zxJPFfATNnz5377+4ZoX f1nE9Pk2uEr8ZmS4+DXhw3Q2tqVfFxn9KHnpf+2Zr3NpxrwzTnIv7nIHFm1RYinOSDTUYi4q TgQAZc1IfBYDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRmVeSWpSXmKPExsVy+t/xu7rMh0TjDK70slhcuXiIyWLjjPWs FlMfPmGzOHG4kdmifWYHo8X58xvYLS7vmsNmMeP8PiaLtUfuslscftPOarHn4it2B26PDZ+b 2DwWbCr12LSqk82jb8sqRo/Pm+QCWKP0bIryS0tSFTLyi0tslaINLYz0DC0t9IxMLPUMjc1j rYxMlfTtbFJSczLLUov07RL0Mrrab7EX/BWsmPWhmamB8Sh/FyMnh4SAicSJu5uYQGwhgaWM EneeG0DEZSROTmtghbCFJf5c62LrYuQCqvnEKLH8cycjSIJNwFCi6y1IgpNDRCBF4ueMdYwg RcwCN5kkfixezgySEBaIkehe9gJsEouAqsSp9n9gcV4BW4lrXzcyQWyQl1i94QDzBEaeBYwM qxhFUkuLc9Nzi430ihNzi0vz0vWS83M3MQJDdduxn1t2MHa9Cz7EKMDBqMTD+2OxSJwQa2JZ cWXuIUYJDmYlEV4tHaAQb0piZVVqUX58UWlOavEhRlOg5ROZpUST84FxlFcSb2hqaG5haWhu bG5sZqEkztshcDBGSCA9sSQ1OzW1ILUIpo+Jg1OqgXFhsGfksr/i+Un/p7pMUr30jUk1uqv0 9G8Tt9T/3CVG6yPs7ebys6S05L1YrJqc2Zy26+KieG8JNk+Fjz+rMk7dyXEP7Hh4wufA78dm z97fyvL/fUnZ8+ydB2ysN+bxq/UWTuHneT2xagP3g/4jT960Op1vZfl/5o+mS8j+puT5FwQ+ zfW1S1diKc5INNRiLipOBAD0phjzawIAAA== X-CMS-MailID: 20200108115027eucas1p2abcd40e359e993e5b471229b02b69fc3 X-Msg-Generator: CA X-RootMTR: 20200108115027eucas1p2abcd40e359e993e5b471229b02b69fc3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200108115027eucas1p2abcd40e359e993e5b471229b02b69fc3 References: Cc: Jimmy Cheng-Yi Chiang , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Tzung-Bi Shih , Mark Brown , Sylwester Nawrocki , Dylan Reid , Marek Szyprowski Subject: [alsa-devel] [PATCH 1/2] ASoC: max98090: fix incorrect helper in max98090_dapm_put_enum_double() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Commit 62d5ae4cafb7 ("ASoC: max98090: save and restore SHDN when changing sensitive registers") extended the code for handling "LTENL Mux", "LTENR Mux", "LBENL Mux" and "LBENR Mux" controls by adding a custom max98090_dapm_put_enum_double() function to them. However that function used incorrect helper to get its component object. Fix this by using the proper snd_soc_dapm_* helper. This fixes the following NULL pointer exception observed on Exynos4412-based Odroid U3 board: 8<--- cut here --- Unable to handle kernel NULL pointer dereference at virtual address 000000b0 pgd = (ptrval) [000000b0] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 1104 Comm: alsactl Not tainted 5.5.0-rc5-next-20200107 #166 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) PC is at __mutex_lock+0x54/0xb18 LR is at ___might_sleep+0x3c/0x2e0 ... Process alsactl (pid: 1104, stack limit = 0x(ptrval)) ... [] (__mutex_lock) from [] (mutex_lock_nested+0x1c/0x24) [] (mutex_lock_nested) from [] (max98090_shdn_save+0x1c/0x28) [] (max98090_shdn_save) from [] (max98090_dapm_put_enum_double+0x20/0x40) [] (max98090_dapm_put_enum_double) from [] (snd_ctl_ioctl+0x190/0xbb8) [] (snd_ctl_ioctl) from [] (ksys_ioctl+0x470/0xaf8) [] (ksys_ioctl) from [] (ret_fast_syscall+0x0/0x28) ... ---[ end trace 0e93f0580f4b9241 ]--- Fixes: 62d5ae4cafb7 ("ASoC: max98090: save and restore SHDN when changing sensitive registers") Signed-off-by: Marek Szyprowski Reviewed-by: Tzung-Bi Shih --- sound/soc/codecs/max98090.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 4c7b16d557e2..c01ce4a3f86d 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -82,7 +82,7 @@ static int max98090_dapm_put_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *component = - snd_soc_kcontrol_component(kcontrol); + snd_soc_dapm_kcontrol_component(kcontrol); struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); int ret; From patchwork Wed Jan 8 11:50:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 11323389 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6CB6109A for ; Wed, 8 Jan 2020 11:52:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DC382077B for ; Wed, 8 Jan 2020 11:52:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="bR+lmwCc"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="Le4Zpk76" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DC382077B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 16B501732; Wed, 8 Jan 2020 12:51:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 16B501732 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578484339; bh=GW72vant9q/lje30JiFF4dK140NQaAEkAI0YUOXGR5U=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bR+lmwCcptXA6JBvop1kaahFCQqh//war+eMTYH6bai5Mbe+jpaJ/O5YM0B40j5t0 7ix+FHgBKrF/ektnMikXMUtmsLlYq6O4sIxCZbmV5uLvlp+2E/Qlb/0EioSUpkwHmn hK6y+4nl12DPr53UFTcVfbir9HWRFfw1r/V0LNpU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F270AF80214; Wed, 8 Jan 2020 12:50:35 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 97F1EF80159; Wed, 8 Jan 2020 12:50:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6A7F0F8010B for ; Wed, 8 Jan 2020 12:50:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6A7F0F8010B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="Le4Zpk76" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200108115028euoutp0159b57c3ae19f151f96ed2f95e86b9e08~n5wrxRVyc0535205352euoutp01T for ; Wed, 8 Jan 2020 11:50:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200108115028euoutp0159b57c3ae19f151f96ed2f95e86b9e08~n5wrxRVyc0535205352euoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1578484228; bh=+tf4GNTb84v10z63faMIMGJF9BpS6VYqSHVRHe4D8GQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Le4Zpk76bIibTVmOwU78VHbBOtjpJ6lrVCygD6Kr6b2Tt876+PZ1fnfnkXP9WJD9P Xn4LU01uOR2awCY8ECTVU25vcT572IRVXF3VCIxEYR8sVHDvFuqmIA2trQZqj0z53q +rmJvMsUyuvBiKuw/M6Hf+kkNDzWxbjJMq9NPr90= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200108115028eucas1p16b28b9fc0c43953728d94c2f857fd01f~n5wrORNFD2632626326eucas1p18; Wed, 8 Jan 2020 11:50:28 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 46.A5.60679.302C51E5; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200108115027eucas1p1d3645ba53703780679c662921efbca78~n5wq2ZUJc0954609546eucas1p1D; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200108115027eusmtrp2440bee433050820256d5907847ffbc3b~n5wq1vIf-1831018310eusmtrp2d; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-4e-5e15c2038a2d Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 0F.16.08375.302C51E5; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200108115027eusmtip130fdd566eb8e26c80f969ea589089877~n5wqXbJew1795217952eusmtip18; Wed, 8 Jan 2020 11:50:27 +0000 (GMT) From: Marek Szyprowski To: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Date: Wed, 8 Jan 2020 12:50:07 +0100 Message-Id: <20200108115007.31095-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200108115007.31095-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42LZduznOV3mQ6JxBltvW1hcuXiIyWLjjPWs FlMfPmGzOHG4kdmifWYHo8X58xvYLS7vmsNmMeP8PiaLtUfuslscftPOarHn4it2B26PDZ+b 2DwWbCr12LSqk82jb8sqRo/Pm+QCWKO4bFJSczLLUov07RK4Mt7+vcBaMFuvYsO2IywNjFPU uhg5OSQETCQudM5h7GLk4hASWMEocezwdRYI5wujxOGn19ghnM+MEkdevWaFafn64xorRGI5 o8TmDYtY4Vo237zOBlLFJmAo0fW2C8wWEUiSOL/gNjNIEbPAZSaJ1Y39zCAJYQELiWffvwPZ HBwsAqoS9xurQMK8ArYSB2a8YYbYJi+xesMBsBJOATuJR0ug7m5nlzixIQzCdpG4daUZqlxY 4tXxLewQtozE/53zmUDWSgg0M0o8PLeWHcLpYZS43DSDEaLKWuLOuV9sIAuYBTQl1u/Shwg7 Smza/J4dJCwhwCdx460gSJgZyJy0bTozRJhXoqNNCKJaTWLW8XVwaw9euAR1jofE87MzoME7 kVFi7ZPnrBMY5WchLFvAyLiKUTy1tDg3PbXYKC+1XK84Mbe4NC9dLzk/dxMjMJWc/nf8yw7G XX+SDjEKcDAq8fD+WCwSJ8SaWFZcmXuIUYKDWUmEV0sHKMSbklhZlVqUH19UmpNafIhRmoNF SZzXeNHLWCGB9MSS1OzU1ILUIpgsEwenVAOj0Zq7R3M5ZbfVl1c2F3ZVtP+Rctpg97Rnwfzc p6uTJC73xa+SsG6J6O7W8mMM+XhBq/HD1n/n1T60Vh/gP27gM92XS+Lm59tdj5/KTdVV2d+Q GvS89JdZruy8BaaPn5oUy+8pXR+uUt3qsHH+lsDSP+6Gsb/mnJoVEG7qXJnYacCwZJrP8g9K LMUZiYZazEXFiQCSPfbeIQMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsVy+t/xu7rMh0TjDJbdULa4cvEQk8XGGetZ LaY+fMJmceJwI7NF+8wORovz5zewW1zeNYfNYsb5fUwWa4/cZbc4/Kad1WLPxVfsDtweGz43 sXks2FTqsWlVJ5tH35ZVjB6fN8kFsEbp2RTll5akKmTkF5fYKkUbWhjpGVpa6BmZWOoZGpvH WhmZKunb2aSk5mSWpRbp2yXoZbz9e4G1YLZexYZtR1gaGKeodTFyckgImEh8/XGNFcQWEljK KLF7HhdEXEbi5LQGVghbWOLPtS62LkYuoJpPjBJ/ln4AS7AJGEp0vQVJcHKICKRI/JyxjhGk iFngJpPEj8XLmUESwgIWEs++fweyOThYBFQl7jdWgYR5BWwlDsx4wwyxQF5i9YYDYCWcAnYS j5aoQdxjK7H76ATmCYx8CxgZVjGKpJYW56bnFhvqFSfmFpfmpesl5+duYgSG9bZjPzfvYLy0 MfgQowAHoxIP74/FInFCrIllxZW5hxglOJiVRHi1dIBCvCmJlVWpRfnxRaU5qcWHGE2BTprI LCWanA+MubySeENTQ3MLS0NzY3NjMwslcd4OgYMxQgLpiSWp2ampBalFMH1MHJxSDYxCk0x2 Vi8o2OReIHbsw1rf3dYhOWmd6cI501Pj2247hcQvuHA6QqYzad1GkVde2Q0xvAqr6zqvN7ye liC4sf3M4zfml9c8qolbHTYvrapukdCvk/VtgZIVTxbdyTx5VVxN69D1X70zmWxt7bJYA+1y 5wgKHU9W/vabM5+Z55RHdl5MrKPpcSWW4oxEQy3mouJEAM1aaCyBAgAA X-CMS-MailID: 20200108115027eucas1p1d3645ba53703780679c662921efbca78 X-Msg-Generator: CA X-RootMTR: 20200108115027eucas1p1d3645ba53703780679c662921efbca78 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200108115027eucas1p1d3645ba53703780679c662921efbca78 References: <20200108115007.31095-1-m.szyprowski@samsung.com> Cc: Jimmy Cheng-Yi Chiang , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Tzung-Bi Shih , Mark Brown , Sylwester Nawrocki , Dylan Reid , Marek Szyprowski Subject: [alsa-devel] [PATCH 2/2] ASoC: max98090: fix lockdep warning X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Commit 62d5ae4cafb7 ("ASoC: max98090: save and restore SHDN when changing sensitive registers") extended the code for handling many controls by adding a custom put function to them. That new custom put function properly handles relations between codec's hardware registers. However they used card->dapm_mutex to properly serialize those operations. This in turn triggers a lockdep warning about possible circular dependency. Fix this by introducing a separate mutex only for serializing the SHDN hardware register related operations. This fixes the following lockdep warning observed on Exynos4412-based Odroid U3 board: ====================================================== WARNING: possible circular locking dependency detected 5.5.0-rc5-next-20200107 #166 Not tainted ------------------------------------------------------ alsactl/1104 is trying to acquire lock: ed0d50f4 (&card->dapm_mutex){+.+.}, at: max98090_shdn_save+0x1c/0x28 but task is already holding lock: edb4b49c (&card->controls_rwsem){++++}, at: snd_ctl_ioctl+0xcc/0xbb8 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&card->controls_rwsem){++++}: snd_ctl_add_replace+0x3c/0x84 dapm_create_or_share_kcontrol+0x24c/0x2e0 snd_soc_dapm_new_widgets+0x308/0x594 snd_soc_bind_card+0x80c/0xad4 devm_snd_soc_register_card+0x34/0x6c odroid_audio_probe+0x288/0x34c platform_drv_probe+0x6c/0xa4 really_probe+0x200/0x490 driver_probe_device+0x78/0x1f8 bus_for_each_drv+0x74/0xb8 __device_attach+0xd4/0x16c bus_probe_device+0x88/0x90 deferred_probe_work_func+0x3c/0xd0 process_one_work+0x22c/0x7c4 worker_thread+0x44/0x524 kthread+0x130/0x164 ret_from_fork+0x14/0x20 0x0 -> #0 (&card->dapm_mutex){+.+.}: lock_acquire+0xe8/0x270 __mutex_lock+0x9c/0xb18 mutex_lock_nested+0x1c/0x24 max98090_shdn_save+0x1c/0x28 max98090_put_enum_double+0x20/0x40 snd_ctl_ioctl+0x190/0xbb8 ksys_ioctl+0x470/0xaf8 ret_fast_syscall+0x0/0x28 0xbefaa564 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&card->controls_rwsem); lock(&card->dapm_mutex); lock(&card->controls_rwsem); lock(&card->dapm_mutex); *** DEADLOCK *** 1 lock held by alsactl/1104: #0: edb4b49c (&card->controls_rwsem){++++}, at: snd_ctl_ioctl+0xcc/0xbb8 stack backtrace: CPU: 0 PID: 1104 Comm: alsactl Not tainted 5.5.0-rc5-next-20200107 #166 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) (unwind_backtrace) from [] (show_stack+0x10/0x14) (show_stack) from [] (dump_stack+0xb4/0xe0) (dump_stack) from [] (check_noncircular+0x1ec/0x208) (check_noncircular) from [] (__lock_acquire+0x1210/0x25ec) (__lock_acquire) from [] (lock_acquire+0xe8/0x270) (lock_acquire) from [] (__mutex_lock+0x9c/0xb18) (__mutex_lock) from [] (mutex_lock_nested+0x1c/0x24) (mutex_lock_nested) from [] (max98090_shdn_save+0x1c/0x28) (max98090_shdn_save) from [] (max98090_put_enum_double+0x20/0x40) (max98090_put_enum_double) from [] (snd_ctl_ioctl+0x190/0xbb8) (snd_ctl_ioctl) from [] (ksys_ioctl+0x470/0xaf8) (ksys_ioctl) from [] (ret_fast_syscall+0x0/0x28) ... Fixes: 62d5ae4cafb7 ("ASoC: max98090: save and restore SHDN when changing sensitive registers") Signed-off-by: Marek Szyprowski --- sound/soc/codecs/max98090.c | 10 ++++++---- sound/soc/codecs/max98090.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index c01ce4a3f86d..454cb8e5b0a1 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -52,14 +52,14 @@ static void max98090_shdn_restore_locked(struct max98090_priv *max98090) static void max98090_shdn_save(struct max98090_priv *max98090) { - mutex_lock(&max98090->component->card->dapm_mutex); + mutex_lock(&max98090->shdn_lock); max98090_shdn_save_locked(max98090); } static void max98090_shdn_restore(struct max98090_priv *max98090) { max98090_shdn_restore_locked(max98090); - mutex_unlock(&max98090->component->card->dapm_mutex); + mutex_unlock(&max98090->shdn_lock); } static int max98090_put_volsw(struct snd_kcontrol *kcontrol, @@ -2313,12 +2313,12 @@ static void max98090_pll_work(struct max98090_priv *max98090) */ /* Toggle shutdown OFF then ON */ - mutex_lock(&component->card->dapm_mutex); + mutex_lock(&max98090->shdn_lock); snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN, M98090_SHDNN_MASK, 0); snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN, M98090_SHDNN_MASK, M98090_SHDNN_MASK); - mutex_unlock(&component->card->dapm_mutex); + mutex_unlock(&max98090->shdn_lock); for (i = 0; i < 10; ++i) { /* Give PLL time to lock */ @@ -2731,6 +2731,8 @@ static int max98090_i2c_probe(struct i2c_client *i2c, if (max98090 == NULL) return -ENOMEM; + mutex_init(&max98090->shdn_lock); + if (ACPI_HANDLE(&i2c->dev)) { acpi_id = acpi_match_device(i2c->dev.driver->acpi_match_table, &i2c->dev); diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h index 0a31708b7df7..dabd8be34a01 100644 --- a/sound/soc/codecs/max98090.h +++ b/sound/soc/codecs/max98090.h @@ -1539,6 +1539,7 @@ struct max98090_priv { unsigned int pa2en; unsigned int sidetone; bool master; + struct mutex shdn_lock; int saved_count; int saved_shdn; };