From patchwork Mon Mar 11 12:17:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 779922 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F133D3BBF7 for ; Mon, 11 Mar 2024 12:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710159479; cv=none; b=Rpw3cACr7dr9U9Ik8M2KTDLf5hFLX98KvcD8Iwqs8SXE82ytPY+7eFgF/5A4o07756ErsNkHt/JIua2lMdS6ukQxUu7WUCZmXMtYgVc51wdx9qkshOgWkbhwFWCYaXvKZyabKXEkhJKy/5OcyKzWeNClA3077X1zRwSCY8EGB/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710159479; c=relaxed/simple; bh=a2lHQAJJDKnUHqUq8InTqh4Vy8nT/QZjr0FLyvI2Hqk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Kz4TAPtjJ5XF2FUKEwd3Xilwp/Et86QHgH4xWriTMR/B3mvGd3enl61pzmjUXaOnMquFAp0NgUnMry1QPR9Lzf6TqSzmBpvTJt+AV/cVNUdwHnIUzWWbssgbGFK7tUhpk5d2R3wT7kBNsa0u6p+22O9oV2Voi2fKhMOM1yfq0l8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WgricwHS; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WgricwHS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710159477; x=1741695477; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a2lHQAJJDKnUHqUq8InTqh4Vy8nT/QZjr0FLyvI2Hqk=; b=WgricwHSBV6Wwrp3FsWRWekY6wl4KUeMvl4qZMa5+hSXdE+KbMUTjq5w 1b8ZAEAz8k7sLMhEfebWvHFNCMQA2MqRvg9rvNHtr3qk6nAyAtjNeONbO KxtJmU+EQN2NvdXp1Kk+6qHaQ68NcTW6TdmhvXZd7YKsNRFC2UkJ72n4J yV3MOE6+lghRs1YcapZGi/XjKumZ1rqvEIgkVE7XLy76up0fP2Givxx2J yaNW0GkyvCPqoyoAE/QhtI9XHVHuHUBdqbE2I8yth9qnp+YvaJQScp1Er 9lCzIZm7pbEZNJgYniVwcU+iwze/QCASHj+J8Lb/imb4LRHvudzclCXca g==; X-IronPort-AV: E=McAfee;i="6600,9927,11009"; a="4929917" X-IronPort-AV: E=Sophos;i="6.07,116,1708416000"; d="scan'208";a="4929917" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 05:17:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,116,1708416000"; d="scan'208";a="11239419" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 05:17:53 -0700 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 36F731201F7; Mon, 11 Mar 2024 14:17:51 +0200 (EET) Received: from sailus by punajuuri.localdomain with local (Exim 4.96) (envelope-from ) id 1rjebH-005FBJ-0h; Mon, 11 Mar 2024 14:17:51 +0200 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: jacopo.mondi@ideasonboard.com, Alexander Stein Subject: [PATCH 2/2] media: v4l: async: Properly check for a notifier initialised or registered Date: Mon, 11 Mar 2024 14:17:41 +0200 Message-Id: <20240311121741.1249976-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240311121741.1249976-1-sakari.ailus@linux.intel.com> References: <20240311121741.1249976-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Properly check that a notifier was never initialised or register. This can now be done by looking at the entry in the notifier list, not the V4L2 device or sub-device that are set in the initialiser now. Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init") Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-async.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 2ff35d5d60f2..3b43d6285dfe 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -630,12 +630,14 @@ EXPORT_SYMBOL(v4l2_async_nf_register); static void __v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) { - if (!notifier || (!notifier->v4l2_dev && !notifier->sd)) + /* Return here if the notifier is never initialised or registered. */ + if (!notifier->notifier_entry.next || + list_empty(¬ifier->notifier_entry)) return; v4l2_async_nf_unbind_all_subdevs(notifier); - list_del(¬ifier->notifier_entry); + list_del_init(¬ifier->notifier_entry); } void v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier)