Re: [RFC/PATCH 02/10] media: Media device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
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


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux