Received: by 10.213.65.68 with SMTP id h4csp1327957imn; Wed, 21 Mar 2018 08:05:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELt42fbBsUEEG0mWEfdAR/KC7WNOjsFlcRXhsjscO4CNgkj1EgJQqRlskFcD7g0WSiaQo8hV X-Received: by 10.99.190.5 with SMTP id l5mr936272pgf.25.1521644742926; Wed, 21 Mar 2018 08:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521644742; cv=none; d=google.com; s=arc-20160816; b=jpz3tCHPDpTn7z4+CDcR+H4Or5PqhvdDip3DC0EjmJR0/EJeEYK/GHmsG0wA5+Wk0f PXZ3mpIvzeDKJWjnbkBI26rZGVRLLd9dPgy7SVUh0cdz/H6OowH+mpcXKrcVdFzwy75U wuz9U4de1cP62EN/JM3uHhzTqCAVmezz6sWkXNIz9DIqdOpA2FDwS1w0Erb/Xf4brn+P l5T3dQpFgSpo3CtRbMmJMbPeWRP5eaJhPPRnTXMpVvbZpyC42U8FnyIKXxFDt3QWplau 2139283Qjh/HzzXJl/J9Di1nTuknFZdBIYnTXKihpv59/YkaO52ZQflF5OWy370Ycamx Rd4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=9hAACXQSH3spfBfghLRk4sm6LRxUQFQJOZdcQhIMgPc=; b=WFFPpybpzTypZknaBJUD4wFbzkuhA8GgH/Tx+bOtOtrfWUiDHw65vdZxgLTiMGALqP 3SXaVDs3JJKFeXt/YQ+0zOJa6GuWluZOrhHGUWHZzAaKJWP7WPVAL+Q2fPNerCBJ35aN +Zp+fRmYD3zBpzTSiCkbohA9QDKQPb0a19ARObNtYIk8EzzBY0BMQnZyuzMCVxsB5U+G zKJFZDeV6sPyGMzX+dSfArB1tHclkK0kRLYcx7C61pwM9X3IV4OJJl0a+KntNtlKdVRK 1XpQG1mckqFOHkpBYr5L6TGir271TgiofF2s4pUh7UyNv3/C+EZZ1yqDe4NZhJA4fHvz bwIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=opk35qIK; 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 p33-v6si4238550pld.224.2018.03.21.08.05.27; Wed, 21 Mar 2018 08:05:42 -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=opk35qIK; 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 S1752470AbeCUPDY (ORCPT + 99 others); Wed, 21 Mar 2018 11:03:24 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:41825 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752105AbeCUPDW (ORCPT ); Wed, 21 Mar 2018 11:03:22 -0400 Received: by mail-qt0-f196.google.com with SMTP id j4so5565457qth.8 for ; Wed, 21 Mar 2018 08:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=9hAACXQSH3spfBfghLRk4sm6LRxUQFQJOZdcQhIMgPc=; b=opk35qIKLhG6QvFakIRJeNeaZRVIjkIAvg0fOHZ5tqTgHNVHhKmlcBSJ5y2m3fjbsP fi2FzVYXK8szZRbs+qvcZPZdjHio1cyPU7pxbeImvKB18QBUFmV74zayx3TJ4MIIDMLE 0gh9P70MxmaS6HbAidJjVpcQ8JUGpfXEQFf/ImY4Vwl4RzPjx8tE3Cvg4SMgcAAZzwKU NUJ0umII1R9h2HN1WqPXCMCatAOlkZvkt0WOboVwIISkAJHF8S7sWZQ/nU8ZRtTd4fL2 4Z4DqL4gaL8gIXcJ2ca2B7x8BibiASVkrN/5SOMIwXM1ANCxvFKauJobHQWgNS1gU1dS JaIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=9hAACXQSH3spfBfghLRk4sm6LRxUQFQJOZdcQhIMgPc=; b=QOqrm/s/fnkPeAyRdTvkAkwng/qgBlN/1MZLaRSJ1vd+9+kPHuiL0cHETf7R39lGRZ lZg1arXy+59T0zZwFoGERD8Q+DR+FDO9q0AXLcFQUnMf98t9CciN4I97XM3KrBEdrVE9 caTa1LE5vK/YM9wxY2/2MgWaA/qq4vX0sbI5UX8wmwORS7RESTQm7J0Sx/tYn4ZE+mCq mbxV7iIYs0YRlOW5RcXa/QvUGQ4C95J1CcPFh/Sxn7zXlvnA6c1QSwaVulhLei3u6+VM +/g3k3lctHHUjdwXqfFk0nKMa9Kd0DWSCHo3qPBdO2U7erjsf4S95N/wqpjVjml8vtCo HP4Q== X-Gm-Message-State: AElRT7GQj+05+OAfOhY0mVlb+Mq9IM6wt/yb7LMkPPwuvCsERGuvwIXm oX1UuhwuEVk7Cvvxm62sje1pQJ06QphmMjFuR9c= X-Received: by 10.237.35.216 with SMTP id k24mr78353qtc.40.1521644601978; Wed, 21 Mar 2018 08:03:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.137.74 with HTTP; Wed, 21 Mar 2018 08:03:21 -0700 (PDT) In-Reply-To: <1a59a938-0381-49f4-dfd9-c7a52bdb0eae@gmail.com> References: <63ee611d-9fd7-a67a-45aa-229cc4a83ed2@gmail.com> <20180313193414.11535-1-k.marinushkin@gmail.com> <1a59a938-0381-49f4-dfd9-c7a52bdb0eae@gmail.com> From: Andy Shevchenko Date: Wed, 21 Mar 2018 17:03:21 +0200 Message-ID: Subject: Re: [PATCH v2] staging: bcm2835-audio: Release resources on module_exit() To: Kirill Marinushkin 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? % 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. -- With Best Regards, Andy Shevchenko