On Thu, 2009-06-04 at 11:18 +0200, Laurent Pinchart wrote: > Hi, > > On Thursday 04 June 2009 06:20:07 figo.zhang wrote: > > The function video_register_device() will call the > > video_register_device_index(). In this function, firtly it will do some > > argments check , if failed,it will return a negative number such as > > -EINVAL, and then do cdev_alloc() and device_register(), if success return > > zero. so video_register_device_index() canot return a a positive number. > > > > for example, see the drivers/media/video/stk-webcam.c (line 1325): > > > > err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1); > > if (err) > > STK_ERROR("v4l registration failed\n"); > > else > > STK_INFO("Syntek USB2.0 Camera is now controlling video device" > > " /dev/video%d\n", dev->vdev.num); > > > > in my opinion, it will be cleaner to do something like this: > > > > err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1); > > if (err != 0) > > STK_ERROR("v4l registration failed\n"); > > else > > STK_INFO("Syntek USB2.0 Camera is now controlling video device" > > " /dev/video%d\n", dev->vdev.num); > > What's the difference ? (err != 0) and (err) are identical. > > Best regards, > > Laurent Pinchart yes, it is the same, but it is easy for reading. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html