This would work but another approach would be to to allocate "usbvision" with devm_kzalloc(&dev->dev,... I believe that would postpone the free enough to solve the use after free but I hadn't tested it yet. But other drivers do that so hopefully it works. regards, dan carpenter