From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757848AbbGQKxJ (ORCPT ); Fri, 17 Jul 2015 06:53:09 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:25242 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757817AbbGQKxH (ORCPT ); Fri, 17 Jul 2015 06:53:07 -0400 Date: Fri, 17 Jul 2015 13:52:44 +0300 From: Dan Carpenter To: Sudip Mukherjee Cc: devel@driverdev.osuosl.org, Lidza Louina , Daeseok Youn , driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH 1/4] staging: dgap: fix error path Message-ID: <20150717105244.GA5422@mwanda> References: <1437051500-20419-1-git-send-email-sudipm.mukherjee@gmail.com> <20150717093003.GA5371@mwanda> <20150717095128.GA3229@sudip-PC> <20150717100555.GB5371@mwanda> <20150717102721.GA3832@sudip-PC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150717102721.GA3832@sudip-PC> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 17, 2015 at 03:57:21PM +0530, Sudip Mukherjee wrote: > On Fri, Jul 17, 2015 at 01:05:55PM +0300, Dan Carpenter wrote: > > On Fri, Jul 17, 2015 at 03:21:28PM +0530, Sudip Mukherjee wrote: > > > On Fri, Jul 17, 2015 at 12:30:03PM +0300, Dan Carpenter wrote: > > > > I don't think I like these at all. remove_one has always been buggy in > > > > that it removes everything. We should fix it to only remove one instead > > > > of formalizing the currect terrible behavior. > > > Its already applied. > > > I thought after the full series the code became a little better than the > > > original one. > > > > It looks nicer but it's wrong. > > > > > > > Now dgap_stop() is being called from dgap_remove_one(). How do you suggest > > > it should be? > > > > dgap_remove_one() should mirror dgap_init_one(). dgap_stop() should > > only be called from dgap_cleanup_module(). dgap_cleanup_module() should > > mirror dgap_init_module(). > But if dgap_stop() is only called from dgap_cleanup_module() then what > will happen if the pci device is suddenly removed? > Currently if the pci device is removed then the remove callback will be > executed and it will stop and unregister everything properly. It shouldn't be unregistering everything when one thing is removed, it should only unregister the stuff that is removed. regards, dan carpenter