From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757520AbYBDWiS (ORCPT ); Mon, 4 Feb 2008 17:38:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753490AbYBDWiG (ORCPT ); Mon, 4 Feb 2008 17:38:06 -0500 Received: from mk-filter-2-a-1.mail.uk.tiscali.com ([212.74.100.53]:5392 "EHLO mk-filter-2-a-4.mail.uk.tiscali.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751415AbYBDWiE (ORCPT ); Mon, 4 Feb 2008 17:38:04 -0500 X-Trace: 667989755/mk-filter-2.mail.uk.tiscali.com/B2C/$THROTTLED-DYNAMIC/CUSTOMER-DYNAMIC-IP/81.1.89.66 X-SBRS: None X-RemoteIP: 81.1.89.66 X-IP-MAIL-FROM: adrian@newgolddream.dyndns.info X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FADgip0dRAVlC/2dsb2JhbACBWKso Subject: Re: [PATCH] SH/Dreamcast - fix regressions, whitespace and memory leaks in Maple Bus driver From: Adrian McMenamin To: Greg KH Cc: Paul Mundt , linux-sh , LKML In-Reply-To: <20080204161437.GA20739@kroah.com> References: <1202068847.6262.7.camel@localhost.localdomain> <20080204052900.GB7585@kroah.com> <1202113675.6489.6.camel@localhost.localdomain> <20080204161437.GA20739@kroah.com> Content-Type: text/plain Date: Mon, 04 Feb 2008 22:37:37 +0000 Message-Id: <1202164657.7046.5.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2008-02-04 at 08:14 -0800, Greg KH wrote: > On Mon, Feb 04, 2008 at 08:27:55AM +0000, Adrian McMenamin wrote: > > > > On Sun, 2008-02-03 at 21:29 -0800, Greg KH wrote: > > > On Sun, Feb 03, 2008 at 08:00:47PM +0000, Adrian McMenamin wrote: > > > > From: Adrian McMenamin > > > > > > > > This patch fixes the regression noted here: > > > > http://lkml.org/lkml/2008/1/26/189 as well as whitespace issues in the > > > > previous commit of this driver and the memory leaks noted here: > > > > http://lkml.org/lkml/2008/2/2/143 (as well as one or two other minor > > > > cleanups). > > > > > > Which portion of the patch fixes the kobject WARN_ON()? > > > > > > > > + if (mdev->registered == 0) { > > + retval = device_register(&mdev->dev); > > + if (retval) { > > + printk(KERN_INFO > > + "Maple bus: Attempt to register device" > > + " (%x, %x) failed.\n", > > + mdev->port, mdev->unit); > > + maple_free_dev(mdev); > > + mdev = NULL; > > + return; > > + } > > + mdev->registered = 1; > > + } > > } > > > > > > Specifically the check on mdev->registered > > So the code path could cause devices to be registered more than once? > That seems broken, as no other bus that I know of needs such a check :( > > Is there a way to fix the root problem here, instead of this type of > change? > The hardware is very flaky. If I add in delays to the bus start, it will detect the devices, but it's not brilliant. Registering an empty device got round that problem, at the price of testing for the earlier registration.