From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755604AbbESMdJ (ORCPT ); Tue, 19 May 2015 08:33:09 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33778 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbbESMdE (ORCPT ); Tue, 19 May 2015 08:33:04 -0400 Date: Tue, 19 May 2015 18:02:54 +0530 From: Sudip Mukherjee To: Dan Carpenter Cc: Greg KH , One Thousand Gnomes , Jean Delvare , linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 WIP 5/5] paride: use new parport device model Message-ID: <20150519123254.GA7106@sudip-PC> References: <1430907377-17147-1-git-send-email-sudipm.mukherjee@gmail.com> <1430907377-17147-5-git-send-email-sudipm.mukherjee@gmail.com> <20150519113255.GO22558@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150519113255.GO22558@mwanda> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2015 at 02:32:55PM +0300, Dan Carpenter wrote: > On Wed, May 06, 2015 at 03:46:17PM +0530, Sudip Mukherjee wrote: > > +void *pi_register_driver(char *name) > > +{ > > + struct parport_driver *parp_drv; > > + int ret; > > + > > + parp_drv = kzalloc(sizeof(*parp_drv), GFP_KERNEL); > > + if (!parp_drv) > > + return NULL; > > + > > + parp_drv->name = name; > > + parp_drv->probe = pi_probe; > > + > > + ret = parport_register_driver(parp_drv); > > + > > + if (ret) > > + return NULL; > > Remove the blank line between the call and the error handling. We > should probably free parp_drv on error. yes, i missed that. will add it in the patch. > > > + return (void *)parp_drv; > > +} > > k = 0; > > if (pcd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */ > > cd = pcd; > > @@ -723,6 +730,7 @@ static int pcd_detect(void) > > printk("%s: No CD-ROM drive found\n", name); > > for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) > > put_disk(cd->disk); > > + pi_unregister_driver(par_drv); > > You didn't introduce this, but I think the error handling here is broken > for the autoprobe case. The autoprobe case doesn't have a for loop. ok, will fix it afterwards in a later patch. Alan has the hardware, and I hope he will check that later patch also, like he tested this one. Thanks again Alan. regards sudip