From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Wed, 06 Feb 2008 23:01:27 +0000 Subject: Re: [PATCH 2/2] - SH/Dreamcast - fix maple bus bugs Message-Id: <20080206230127.GA9614@kroah.com> List-Id: References: <1202337981.6162.8.camel@localhost.localdomain> <1202338431.6162.15.camel@localhost.localdomain> In-Reply-To: <1202338431.6162.15.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Adrian McMenamin Cc: Paul Mundt , LKML , linux-sh On Wed, Feb 06, 2008 at 10:53:51PM +0000, Adrian McMenamin wrote: > - dev->function = function; > - dev->dev.bus = &maple_bus_type; > - dev->dev.parent = &maple_bus; > - dev->dev.release = &maple_release_device; > - retval = device_register(&dev->dev); > - if (retval) { > - printk(KERN_INFO > - "Maple bus: Attempt to register device (%x, %x) failed.\n", > - dev->port, dev->unit); > - maple_free_dev(dev); > + mdev->function = function; > + mdev->dev.release = &maple_release_device; > + 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; > } > - dev->registered = 1; I think you are still papering over the real problem here of trying to register a device twice. That's something you should never be doing, and your bus walking logic must be incorrect... thanks, greg k-h