On Wed, May 13, 2015 at 01:22:28PM -0400, Benjamin Romer wrote:
> +     hdr_info = kzalloc(sizeof(*hdr_info), GFP_KERNEL);
> +     if (!hdr_info) {
> +             rc = NULL;
> +             goto away_mem;
> +     }
> +
>       dev_set_name(&devdata->dev, "visorbus%d", id);
>       devdata->dev.bus = &visorbus_type;
>       devdata->dev.groups = visorbus_groups;
> @@ -1344,26 +1352,19 @@ create_bus_instance(struct visorchipset_bus_info 
> *bus_info)
>               POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, id,
>                                POSTCODE_SEVERITY_ERR);
>               rc = NULL;
> -             goto away;
> +             goto away_mem2;
>       }
>       devdata->devno = id;
>       devdata->chan = bus_info->visorchannel;
>       if (bus_info->flags.server) {
>               init_vbus_channel(devdata->chan);
>       } else {
> -             if (get_vbus_header_info(devdata->chan,
> -                                      &devdata->
> -                                      vbus_hdr_info) >= 0) {
> -                     devdata->vbus_valid = true;
> -                     write_vbus_chp_info(devdata->chan,
> -                                         &devdata->
> -                                         vbus_hdr_info,
> -                                         &chipset_driverinfo
> -                                         );
> -                     write_vbus_bus_info(devdata->chan,
> -                                         &devdata->
> -                                             vbus_hdr_info,
> -                                     &clientbus_driverinfo);
> +             if (get_vbus_header_info(devdata->chan, hdr_info) >= 0) {
> +                     devdata->vbus_hdr_info = (void *)hdr_info;
> +                     write_vbus_chp_info(devdata->chan, hdr_info,
> +                                         &chipset_driverinfo);
> +                     write_vbus_bus_info(devdata->chan, hdr_info,
> +                                         &clientbus_driverinfo);
>               }
>       }
>       bus_count++;

We still leak hdr_info on some paths.

regards,
dan carpenter

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to