Re: [PATCH 21/28] media: ti-vpe: cal: fix cal_ctx_v4l2_register error handling

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

 



Hi Tomi,

On Tue, Apr 20, 2021 at 02:17:36PM +0300, Tomi Valkeinen wrote:
> On 20/04/2021 13:50, Tomi Valkeinen wrote:
> > On 18/04/2021 16:09, Laurent Pinchart wrote:
> >> On Mon, Apr 12, 2021 at 02:34:50PM +0300, Tomi Valkeinen wrote:
> >>> cal_ctx_v4l2_register() returns an error code, but the returned error
> >>> code is not handled anywhere. However, we can't really even handle the
> >>> error in any proper way, so lets just drop the return value and make
> >>> sure all error paths have an error print.
> >>
> >> Ouch. Doesn't this call for registering the video node earlier, at probe
> >> time, instead of in the async notifier complete callback ?
> > 
> > Shouldn't we only register uAPI access points after the kernel has 
> > probed (succesfully) the hardware? If we register the video nodes at 
> > probe time I presume we would have to add checks to all the cal ioctl 
> > handlers to check if we have actually probed.

There's a long-lasting debate on this topic :-) The issue with
registering video nodes when all the subdevs have been acquired is that
you should then unregister them with a subdev is removed. The
re-registration gets fairly messy, especially if userspace keeps a video
device node open. It's not like V4L2 handles object life time management
correctly anyway, as it's completely broken in the core, maybe we
shouldn't care and just decide that unbinding a device from its driver
is unsupported.

> > v4l2_async_notifier_operations.complete can return an error, but it's 
> > not quite clear to me what happens in that case and how the driver 
> > should handle it.
> > 
> > I'll look at this a bit, maybe it's still better to handle the error in 
> > complete callback and return the error from there, than ignoring the error.
> 
> Well, handling the error in complete callback seems to work fine. I'm 
> not sure why I didn't do that and instead went with the approach in this 
> patch.

-- 
Regards,

Laurent Pinchart



[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