Re: [PATCH v5 WIP 5/5] paride: use new parport device model

From: Sudip Mukherjee
Date: Tue May 19 2015 - 08:33:12 EST


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;
> > +}
<snip>
> > 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/