Hi, >-----Original Message----- >From: Andy Shevchenko [mailto:andy.shevchenko@xxxxxxxxx] >Sent: Friday, August 28, 2009 4:13 PM >To: Guzman Lugo, Fernando >Cc: Felipe Balbi; Hiroshi DOYU; Ameya Palande; Linux OMAP Mailing List >Subject: Re: [DSPBRIGDE PATCH 6/6] dsp: bridge: beautify erro path > >On Fri, Aug 28, 2009 at 11:58 PM, Guzman Lugo, > > >> @@ -324,7 +324,7 @@ static int __init bridge_init(void) >> if (result < 0) { >> GT_1trace(driverTrace, GT_7CLASS, "bridge_init: " >> "Can't get Major %d \n", driver_major); >> - return result; >> + goto err1; >> } >> >> driver_major = MAJOR(dev); >> @@ -332,19 +332,17 @@ static int __init bridge_init(void) >> bridge_device = kmalloc(sizeof(struct bridge_dev), GFP_KERNEL); >> if (!bridge_device) { >> result = -ENOMEM; >> - unregister_chrdev_region(dev, 1); >> - return result; >> + goto err2; >> } >> cdev_init(&bridge_device->cdev, &bridge_fops); >> bridge_device->cdev.owner = THIS_MODULE; >> bridge_device->cdev.ops = &bridge_fops; >> >> status = cdev_add(&bridge_device->cdev, dev, 1); >> - >> if (status) { >> GT_0trace(driverTrace, GT_7CLASS, >> "Failed to add the bridge device \n"); >> - return status; >result = status, isn't is? >or change status to result on previous lines. > Yes, we need to assigned status to result, in order to report the error, however I think we can get rid of result and use status instead, what do you think? > >> + goto err3; >> } >> >> /* udev support */ >> @@ -474,7 +472,17 @@ static int __init bridge_init(void) >> DBC_Assert(status == 0); >> DBC_Assert(DSP_SUCCEEDED(initStatus)); >> GT_0trace(driverTrace, GT_ENTER, " <- driver_init\n"); >> - return status; >> + >> + return 0; >> + >> +err3: >> + kfree(bridge_device); >> + >> +err2: >> + unregister_chrdev_region(dev, 1); >> + >> +err1: >> + return result; >> } >> >> /* This function is invoked during unlinking of the bridge module from >the > > >-- >With Best Regards, >Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html