From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:40292 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751326AbdJDVu5 (ORCPT ); Wed, 4 Oct 2017 17:50:57 -0400 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: niklas.soderlund@ragnatech.se, maxime.ripard@free-electrons.com, hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, pavel@ucw.cz, sre@kernel.org Subject: [PATCH v15 15/32] v4l: async: Register sub-devices before calling bound callback Date: Thu, 5 Oct 2017 00:50:34 +0300 Message-Id: <20171004215051.13385-16-sakari.ailus@linux.intel.com> In-Reply-To: <20171004215051.13385-1-sakari.ailus@linux.intel.com> References: <20171004215051.13385-1-sakari.ailus@linux.intel.com> Sender: linux-media-owner@vger.kernel.org List-ID: Register the sub-device before calling the notifier's bound callback. Doing this the other way around is problematic as the struct v4l2_device has not assigned for the sub-device yet and may be required by the bound callback. Signed-off-by: Sakari Ailus Acked-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-async.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index e170682dae78..46db85685894 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -130,13 +130,13 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier, { int ret; - ret = v4l2_async_notifier_call_bound(notifier, sd, asd); + ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); if (ret < 0) return ret; - ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); + ret = v4l2_async_notifier_call_bound(notifier, sd, asd); if (ret < 0) { - v4l2_async_notifier_call_unbind(notifier, sd, asd); + v4l2_device_unregister_subdev(sd); return ret; } -- 2.11.0