diff options
Diffstat (limited to 'drivers/media/video/v4l2-dev.c')
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 1ec0a1a8fb73..99f7ee4bc503 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -226,6 +226,7 @@ int video_register_device_index(struct video_device *vfd, int type, int nr, | |||
226 | int end; | 226 | int end; |
227 | int ret; | 227 | int ret; |
228 | char *name_base; | 228 | char *name_base; |
229 | void *priv = video_get_drvdata(vfd); | ||
229 | 230 | ||
230 | /* the release callback MUST be present */ | 231 | /* the release callback MUST be present */ |
231 | BUG_ON(!vfd->release); | 232 | BUG_ON(!vfd->release); |
@@ -295,6 +296,9 @@ int video_register_device_index(struct video_device *vfd, int type, int nr, | |||
295 | 296 | ||
296 | /* sysfs class */ | 297 | /* sysfs class */ |
297 | memset(&vfd->dev, 0, sizeof(vfd->dev)); | 298 | memset(&vfd->dev, 0, sizeof(vfd->dev)); |
299 | /* The memset above cleared the device's drvdata, so | ||
300 | put back the copy we made earlier. */ | ||
301 | video_set_drvdata(vfd, priv); | ||
298 | vfd->dev.class = &video_class; | 302 | vfd->dev.class = &video_class; |
299 | vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); | 303 | vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); |
300 | if (vfd->parent) | 304 | if (vfd->parent) |