--- ozscrlx.c.1 2006-12-12 22:28:24.000000000 +0100 +++ ozscrlx.c 2007-02-17 01:00:46.000000000 +0100 @@ -596,14 +596,14 @@ dev = kzalloc(sizeof(struct ozscr_dev_t), GFP_KERNEL); if (dev == NULL) { dprintk("allocate ozscr_dev_t fail\n"); - goto ErrHandle; + goto ErrHandle1; } /* Allocate space for private device-specific data */ dev->o2scr_reader = kzalloc(sizeof(READER_EXTENSION *), GFP_KERNEL); if (dev->o2scr_reader == NULL) { dprintk("allocate READER_EXTENSION fail\n"); - goto ErrHandle; + goto ErrHandle2; } p_dev->priv = dev; @@ -628,7 +628,7 @@ ret = ozscr_config(p_dev); if (ret) - goto ErrHandle; + goto ErrHandle3; // it's just so redundant... we could merge those fields together dev->o2scr_reader->IOBase = (PSCR_REGISTERS *) dev->io_base; @@ -644,11 +644,11 @@ dprintk("function complete\n"); return 0; - ErrHandle: - /* Free the allocated memory space */ - if (dev) - kfree(dev->o2scr_reader); + ErrHandle3: + kfree(dev->o2scr_reader); + ErrHandle2: kfree(dev); + ErrHandle1: return ret; }