Hi Laurent, > -----Original Message----- > From: Laurent Pinchart [mailto:laurent.pinchart@xxxxxxxxxxxxxxxx] > Sent: Friday, July 16, 2010 3:56 AM > To: Aguirre, Sergio > Cc: linux-media@xxxxxxxxxxxxxxx; sakari.ailus@xxxxxxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [RFC/PATCH 02/10] media: Media device > > Hi Sergio, > > On Thursday 15 July 2010 16:22:06 Aguirre, Sergio wrote: > > > On Wednesday 14 July 2010 08:30:00 Laurent Pinchart wrote: > > <snip> > > > > diff --git a/drivers/media/media-device.c b/drivers/media/media- > device.c > > > new file mode 100644 > > > index 0000000..a4d3db5 > > > --- /dev/null > > > +++ b/drivers/media/media-device.c > > > @@ -0,0 +1,77 @@ > > <snip> > > > > +/** > > > + * media_device_register - register a media device > > > + * @mdev: The media device > > > + * > > > + * The caller is responsible for initializing the media device before > > > + * registration. The following fields must be set: > > > + * > > > + * - dev should point to the parent device. The field can be NULL > when no > > > + * parent device is available (for instance with ISA devices). > > > + * - name should be set to the device name. If the name is empty a > parent > > > + * device must be set. In that case the name will be set to the > parent > > > + * device driver name followed by a space and the parent device > name. > > > + */ > > > +int __must_check media_device_register(struct media_device *mdev) > > > +{ > > > + /* If dev == NULL, then name must be filled in by the caller */ > > > + if (mdev->dev == NULL && WARN_ON(!mdev->name[0])) > > > > If mdev == NULL, you'll have a kernel panic here. > > That's why drivers must not call media_device_register with a NULL pointer > :-) > It's not a valid use case, unlike kfree(NULL) for instance. Right. I know. I guess I was thinking more in terms of not compromising the system because of a buggy driver, and exit gracefully instead... But I guess it's also ok, as a driver developer is usually updating the full kernel anyways. Regards, Sergio > > -- > Regards, > > Laurent Pinchart -- 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