Received: by 10.213.65.68 with SMTP id h4csp1409106imn; Wed, 21 Mar 2018 09:58:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELvki/pudRXNXwtoDf07nzZXNydehpfAfZfBDm2Ibe5QT0V+AtQsrWhFjx8IG8cfTpN2GVFP X-Received: by 2002:a17:902:f44:: with SMTP id 62-v6mr21288879ply.27.1521651529204; Wed, 21 Mar 2018 09:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521651529; cv=none; d=google.com; s=arc-20160816; b=EfePU3YlabrCBJK82IuwAUPjqgbavfjWihM2F18HvaBGiDAy5sYBnIlhqKpylhZMX+ VJMXP9DSsTDEDP6PYSLlBKIpEzEgZJ4NrEatvr6gA357xLjQYUQrJFiG9LX3W+fTbj1o tiJsZ3K1BvFZSDr7xb8Mm9IkLrhJtKGqiIV92xkMMMeHyJIv53U5dNKdKOi7RDr1Tlxp m2ORZruMvBj6Aq6tpkrUV+e1IHozfP2eLxXOc0DPEk9fKe/L9/Hy80vhH9HGOHasg1jE cvuR2q13/8QpyEYk3g+kD2g64pnLu1RKjHK/VUKybYKpl+RNBqyh3rpLaPifatYT+GHg wUDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Mo4THSi+iuyXRd6u/Mrls3nQB6r0ZHfbhPzFA4JbXs4=; b=LXW4FjtufJR50WsbGvCCbaiA51WJJz+o9wiN2Rz3DxkI+gHr10h2Vlv0L3vNOlH4hl kuGdBxHHt9DDOd4nmenUDYLmcTAQVlqum6LASl9TFqiuC6AsM6qZ1ZNcgRi7YAt76iIP Gx8JoC1Axlw+Lvgosk5+tM3nrZaaUs8Tzy4pcmd6FYVFoPXMFR4BhQk7AybkIWfvwRYW NCwbucYCQuGn2uAZtxK2e7p4jIsvFilyKLN/sOaAf5G1fCaQ3GxBVSa1InFXGR6939Z2 EREspHB/6i+3YuuBah/8TY6O0D5SKrK+/XVXmAa27YY7sn2C9xzt74cIdw+OxRBwy1k+ l7+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V5rDHYf+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6-v6si4168275pll.328.2018.03.21.09.58.34; Wed, 21 Mar 2018 09:58:49 -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=@gmail.com header.s=20161025 header.b=V5rDHYf+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751680AbeCUQ5l (ORCPT + 99 others); Wed, 21 Mar 2018 12:57:41 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:50232 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751531AbeCUQ5k (ORCPT ); Wed, 21 Mar 2018 12:57:40 -0400 Received: by mail-wm0-f68.google.com with SMTP id f19so11062465wmc.0 for ; Wed, 21 Mar 2018 09:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Mo4THSi+iuyXRd6u/Mrls3nQB6r0ZHfbhPzFA4JbXs4=; b=V5rDHYf+TJeD6OYYJuLrETzS1xqxBPTmivfdjS4snd0v5/GT1VfiL4fOAI8w04JO6S 4W8NvP8S43DdPMPkALzdyZa/BJp24L2X0UuyHzoZqUyNt4nkvCyhy8EI07H+2vKDg4Fv v7ANeWqfFculCelRrhnvyJMRpAX+8CaU4/uPl3IdxQO7PuV9sCpDPCLcthY+WVjavw+1 XQdZHzFkOk+JmlktaqI2E+AcM4S1nJx/264Mpt1cWV4l/BlX93nYsqUutI8w0Uc6SioF oCa5ldpMNPJHq0Yr2D9tD/Gqlc/Aa+k+pO3qVqsF3GsAitu68PiC9NwyhOFDbHd7TuGT 8QYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Mo4THSi+iuyXRd6u/Mrls3nQB6r0ZHfbhPzFA4JbXs4=; b=Z0aL+NcI0RwfgbWawd5Df+o5JdwpaEbnC8eEAHJHZ5dmX3w0PiUuLyiGluCqol5J8J hwtlmJaHOK2EHIZb16A3RcXrJS+Wz+3y2BtP4uz8Cpi3cQyPk1cXdGz+mtqwPenp2w33 BO4I3u6bFIlfaGuaKBZNtxaXgCjRtoyfzbMxY4yJb3QPOw6ZJNAIziNfWzEq0y4hyiLc BrezUJt4+qXbkt/JBgA05eGQ+K291sHaX4MAfgNh65QyJN8LAHIRoE6UDyazKaYRwmCe cxYcM4rdl/i7+F0u5oh82uC6dnD8Dlq+q1RNro5Z5kHCt4Egh65HGCCepx01BAI0PI3N g9lw== X-Gm-Message-State: AElRT7FICZYYwc7lGG6NKFQ2b2x5JjulXNsHrTnn2Hp36EXK8G4ARyoB M/p9SDOJAiliPa6DxU0julEeta2lrKI= X-Received: by 10.80.230.152 with SMTP id z24mr22650568edm.61.1521651458537; Wed, 21 Mar 2018 09:57:38 -0700 (PDT) Received: from [192.168.1.3] (x4dbc3a40.dyn.telefonica.de. [77.188.58.64]) by smtp.gmail.com with ESMTPSA id j42sm3011259eda.67.2018.03.21.09.57.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 09:57:37 -0700 (PDT) Subject: Re: [PATCH v2] staging: bcm2835-audio: Release resources on module_exit() To: Andy Shevchenko Cc: Greg Kroah-Hartman , Eric Anholt , Stefan Wahren , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list , Michael Zoran , linux-rpi-kernel@lists.infradead.org, linux-arm Mailing List , devel@driverdev.osuosl.org, Linux Kernel Mailing List References: <63ee611d-9fd7-a67a-45aa-229cc4a83ed2@gmail.com> <20180313193414.11535-1-k.marinushkin@gmail.com> <1a59a938-0381-49f4-dfd9-c7a52bdb0eae@gmail.com> From: Kirill Marinushkin Message-ID: <15cc84cc-a887-7473-d64c-00c23e930e0d@gmail.com> Date: Wed, 21 Mar 2018 17:58:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/21/18 16:03, Andy Shevchenko wrote: > On Thu, Mar 15, 2018 at 7:57 AM, Kirill Marinushkin > wrote: >> On 03/13/18 22:23, Andy Shevchenko wrote: >>> On Tue, Mar 13, 2018 at 9:34 PM, Kirill Marinushkin >>> wrote: >>>> In the current implementation, `rmmod snd_bcm2835` does not release >>>> resources properly. It causes an oops when trying to list sound devices. >>>> >>>> This commit fixes it. >>> Nice catch! >>> >>> See my comments below. >>> >>>> static void snd_devm_unregister_child(struct device *dev, void *res) >>>> { >>>> struct device *childdev = *(struct device **)res; >>>> + struct bcm2835_chip *chip = dev_get_drvdata(childdev); >>>> + struct snd_card *card = chip->card; >>>> + >>>> + snd_card_free(card); >>>> + dev_set_drvdata(childdev, NULL); >>> AFAIU this is done by device core. >> Maybe you are right. But I don't know, which function in the device core does it. >> It is safe to have this line. So, I suggest to keep it. > Please, remove. > If you don't know, perhaps you need to spend more time on doing homework? You are right, I actually should pay more attention to this detail. I will remove this line and send as a patch v3 > % git grep -n -w dev_set_drvdata -- drivers/base/dd.c > drivers/base/dd.c:469: dev_set_drvdata(dev, NULL); > drivers/base/dd.c:499: dev_set_drvdata(dev, NULL); > drivers/base/dd.c:902: dev_set_drvdata(dev, NULL); > > Last one is the point of your interest. >