Re: [DSPBRIGDE PATCH 6/6] dsp: bridge: beautify erro path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> +               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��.n��������+%������w��{.n�����{�������ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux