h = kzalloc(sizeof(*h), GFP_KERNEL);
        if (!h)
-               return ERR_CAST(h);
+               return ERR_PTR(-ENOMEM);
 
        h->desc.bLength                 = UVC_DT_HEADER_SIZE(1);
        h->desc.bDescriptorType         = USB_DT_CS_INTERFACE;
 
        format_ptr = kzalloc(sizeof(*format_ptr), GFP_KERNEL);
        if (!format_ptr) {
-               ret = PTR_ERR(format_ptr);
+               ret = -ENOMEM;
                goto out;
        }
        ret = 0;
 
        h = kzalloc(sizeof(*h), GFP_KERNEL);
        if (!h)
-               return ERR_CAST(h);
+               return ERR_PTR(-ENOMEM);
 
        INIT_LIST_HEAD(&h->formats);
        h->desc.bDescriptorType         = USB_DT_CS_INTERFACE;
 
        h = kzalloc(sizeof(*h), GFP_KERNEL);
        if (!h)
-               return ERR_CAST(h);
+               return ERR_PTR(-ENOMEM);
 
        h->frame.b_descriptor_type              = USB_DT_CS_INTERFACE;
        h->frame.b_frame_index                  = 1;
 
        h = kzalloc(sizeof(*h), GFP_KERNEL);
        if (!h)
-               return ERR_CAST(h);
+               return ERR_PTR(-ENOMEM);
 
        h->desc.bLength                 = UVC_DT_FORMAT_UNCOMPRESSED_SIZE;
        h->desc.bDescriptorType         = USB_DT_CS_INTERFACE;
 
        h = kzalloc(sizeof(*h), GFP_KERNEL);
        if (!h)
-               return ERR_CAST(h);
+               return ERR_PTR(-ENOMEM);
 
        h->desc.bLength                 = UVC_DT_FORMAT_MJPEG_SIZE;
        h->desc.bDescriptorType         = USB_DT_CS_INTERFACE;
        count += 2; /* color_matching, NULL */
        *class_array = kcalloc(count, sizeof(void *), GFP_KERNEL);
        if (!*class_array) {
-               ret = PTR_ERR(*class_array);
+               ret = -ENOMEM;
                goto unlock;
        }