Hi Hans, On Thu, Jul 21, 2016 at 11:19:11AM +0200, Hans Verkuil wrote: > Check whether the struct device pointer is NULL and return -EINVAL in that > case. > > This also required a small change to vb2-core where it didn't call PTR_ERR to > get the real error code. > > I have seen several new driver submissions that forgot to set the vb2_queue > dev field, so add these checks to prevent this from happening again. > > The dev field is passed on to the dma-contig/sg drivers in the alloc, get_userptr > and attach_dmabuf callbacks, so this check has to be done in those three places. > > Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx> Considering this is here just to notify driver developers they're doing something wrong, I'd just have a WARN_ON() so they can see what's wrong and fix their code. The debug print contains no additional information. Readability should be the preference instead --- and extra debug prints don't really help with that. It'd be nice if the functions always returned either NULL or an error code. That's not really an issue with this patch, but it extends the use of both of the options in favour of either one. -- Regards, Sakari Ailus e-mail: sakari.ailus@xxxxxx XMPP: sailus@xxxxxxxxxxxxxx -- 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