Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752683AbcJJNeO (ORCPT ); Mon, 10 Oct 2016 09:34:14 -0400 Received: from mail.kernel.org ([198.145.29.136]:35504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752537AbcJJNeM (ORCPT ); Mon, 10 Oct 2016 09:34:12 -0400 MIME-Version: 1.0 In-Reply-To: <175e70d2-1800-3740-c172-793af27b0285@redhat.com> References: <175e70d2-1800-3740-c172-793af27b0285@redhat.com> From: Rob Herring Date: Mon, 10 Oct 2016 08:33:43 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: CONFIG_DEBUG_TEST_DRIVER_REMOVE causes unremovable drivers to bind devices twice To: Laszlo Ersek Cc: Arnd Bergmann , Greg Kroah-Hartman , main kernel list Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2024 Lines: 56 On Mon, Oct 10, 2016 at 8:17 AM, Laszlo Ersek wrote: > Hi, > > Greg asked me to stick to email with this bug report, so I'm reposting > the original kernel bugzilla report to personal addresses, and lkml. > > Thanks, > Laszlo > > https://bugzilla.kernel.org/show_bug.cgi?id=177021 > > Bug ID: 177021 > Summary: [driver core] CONFIG_DEBUG_TEST_DRIVER_REMOVE causes > unremovable drivers to bind devices twice > Product: Drivers > Version: 2.5 > Kernel Version: v4.8-2283-ga3443cd (4.9.0-0.rc0.git2.1.fc26.aarch64) > Hardware: All > OS: Linux > Tree: Mainline > Status: NEW > Severity: normal > Priority: P1 > Component: Other > Assignee: drivers_other@kernel-bugs.osdl.org > Reporter: lersek@redhat.com > CC: arnd@arndb.de, greg@kroah.com > Regression: No > > CONFIG_DEBUG_TEST_DRIVER_REMOVE was added in the following commit: > >> commit bea5b158ff0da9c7246ff391f754f5f38e34577a >> Author: Rob Herring >> Date: Thu Aug 11 10:20:58 2016 -0500 >> >> driver core: add test of driver remove calls during probe [...] > This is almost a regression because the kernel crashes with valid > drivers. It is not an error for a driver to not provide a remove() > callback, so in this instance CONFIG_DEBUG_TEST_DRIVER_REMOVE does not > expose a driver bug, it breaks with a valid driver. Not a regression for > the upstream kernel after all, because the Kconfig documentation > suggests N as default. > > Proposed solution: if none of the remove() methods exist, or the > remove() method that exists fails, then don't release any resources, and > don't re-probe the device. I was thinking no remove method meant the driver didn't need to do any explicit clean-up as all resources used devres, but I guess that's not going to cover things like subsystem de-registration. I'll prepare a fix. Rob