From nobody Mon Jul 27 18:58:43 2026 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 648FA3F12C5 for ; Wed, 8 Jul 2026 15:29:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783524580; cv=none; b=iB7mz4eeBvzFb4vU1/zO9obfv5YHOeTCIKpmZ8EBE4x83rTrYZ1boPzh4HwS+HDhFITVP8sc9fpGyBm58Di+W68k1inBfedCnSoEXDGeK6Y5iOP9OzG2HvSdvxZS/bcW00sDFzhlscjY9YRArRuxYTj2Kf5rAk4lBe3Aig/o9Ow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783524580; c=relaxed/simple; bh=IjflyL3zVyUblwei+sfA2PZGw6L5MMKAZfPBy3T/plo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gCGRTeBsxh/AsfLwfVXWd6i9Hye++gXeGNA8nVhbKybXbU+BNmf9zgOUctwz55zUhkjQwiTIDj8W2nW52YI8Uqzk0G20kNgrn2yJQm7p7oD7YQ8VjR51ZHDCnwhIvsVCjrnhxFhUtmVGXeGDBfU5xtoig92NO8y+iAHD/VLYAZs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mvH4OmPP; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mvH4OmPP" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2cabc0a1ab6so11981545ad.0 for ; Wed, 08 Jul 2026 08:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783524577; x=1784129377; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=y8VL5wx8BrEfM1fCHB+ytQGlVDcPFKqcOjt+LVCCLH8=; b=mvH4OmPP/lC/+vUeSgUWJDeFZEOoG5OUFYm8XhfGs0blTgdkHjCxpXhktnBOACkguO KKKQILkLIsoWSvdMWqtpNXIuaePUG6gUJI9DmuXoXhPx3bBCIXsoLOcGUypcEp/EF5GX JgcAOXNWxpX9gotaq6jP0oxMqxO3H+bDhAyw3YuNHCB1xMzQobjnV+a8LPXhBS7/bHsw sg3b7G3l5G85dv9h68C4poqLC2lnn2/Lun3TAGoxU5Vk11iLkarhzGFmw2zt6TMuUs1E dCbg/sZ54OmZtnmUPpxDMplMz7SuWLz8g1/PFWUooVjDaknuKVZkhEBaBaB2jbOaRQC6 RBJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783524577; x=1784129377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=y8VL5wx8BrEfM1fCHB+ytQGlVDcPFKqcOjt+LVCCLH8=; b=a8AcDbGCXRvpQ1OtwwK9EWWjHx0S7Se9rRMw0glirPAhvEbYCD4wLQeDcllDmJSv6w LW4fpgosgXfTBWeacp0CtIXvvfIlsiCsPNz0wzH8X0tNPBYy+110qfwiLPIlITIOa6DI yI3lDcgekr1gf96QXBIqv0qJXEWXUQnfO6D8bOW8R5B5c80r+kOSNdO9B/1EahRRkggI 49cp+VW+1NiTW6+gKtspqNcsQEwgDyDn6hOY85jFq7joZ8I6D4tVW1PZsgKu4Z35jvUw jaD73pnGLGXPJy60dzY/ZLXjKo73eQPcpi+Z8lNu8Amiv7J59L6EphMFX7tTh/rBfdh5 YpOA== X-Forwarded-Encrypted: i=1; AHgh+Ro71qDGsLWsab7t0SHSHEZxLnFeGy8ZF3IQZcap8TGVvnBvMFjTmpVTLYeppHbRhrYWUG6oTDt8sLRKwzE=@vger.kernel.org X-Gm-Message-State: AOJu0YyHzRwqsa66DWVsy/3RI/WiRT3v0ZIkD4J7/NpyReFkhKHO9SAl 5B8eM6K8mYUcTo5gyI2H0YeROovMZnHA+Ek+VcCKbYgu9B9p+oo0YavQ X-Gm-Gg: AfdE7ckcBhcEOLLbp75tloJCbqLcf8Br826Ij2SI5FWNhEKxiSmUB6nGtcC6vZPN9mQ 3V3FTBmX5ve39LDCqQG8lvA4UEZtfDUMpKWZEx+X6SaiQbcLESsuvfPhx17jYotjFzkkvisB1jS vdo62bsnt3C8POFoCWKZ8vYw3YZM5vDV2DNLGO9dcHwlaxfH49Mh+l1gL/B38hoLJFBaY+IFS8x dsWYGGD8fQxPNhAnuL+NysGGcc8fBv3lAa0JgKsiGL5T0lmcIbXbYfz0Onc1K1h/zy6oWgXP6Rk iBfNs3F6LYAS3f3l2DgUx8R474z2PYMTnHhlggjq5lxspexvcMKvggGwJpVOuDpzQeC4EX3LMPE qvWUFt0A1EXfoEtiMovRgzZG60Z00z0ZQiOAtoW1hjfasDSPgQXCTmHoL6e9Mka1qODV44dIYkR uWUJQl1bx5Aq1WcneVhMLsPE4drBiueWHdmTIOQRhj9dI= X-Received: by 2002:a05:6a20:9c9b:b0:3b3:1c7b:ffb with SMTP id adf61e73a8af0-3c0bca8e5femr4018132637.34.1783524577540; Wed, 08 Jul 2026 08:29:37 -0700 (PDT) Received: from localhost.localdomain ([49.207.223.101]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31174892711sm22334438eec.13.2026.07.08.08.29.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 Jul 2026 08:29:37 -0700 (PDT) From: Biren Pandya To: jacopo+renesas@jmondi.org, kieran.bingham+renesas@ideasonboard.com, laurent.pinchart+renesas@ideasonboard.com, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , mchehab@kernel.org, sakari.ailus@linux.intel.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Biren Pandya Subject: [PATCH v3] media: i2c: rdacm21: Fix missing media_entity_cleanup() Date: Wed, 8 Jul 2026 20:59:28 +0530 Message-ID: <20260708152929.50074-2-birenpandya@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260704201627.82584-2-birenpandya@gmail.com> References: <20260704201627.82584-2-birenpandya@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If an error occurs after media_entity_pads_init() is called, the media entity is left uncleaned, potentially leaking resources or leaving it in an invalid state. Similarly, the remove path misses the cleanup. Add a dedicated error_entity_cleanup label so that media_entity_cleanup() is only invoked on the error path when media_entity_pads_init() has actually succeeded. Also add media_entity_cleanup() to rdacm21_remove() to ensure proper resource release on driver unload. Fixes: a59f853b3b4b ("media: i2c: Add driver for RDACM21 camera module") Signed-off-by: Biren Pandya --- Changes in v3: - Added a blank line after media_entity_cleanup() in the error path (Sakari= ). Changes in v2: - Fixed a bug in v1's probe error handling where media_entity_cleanup() could be called on an uninitialized entity. - Added Signed-off-by tag which was missing in v1. --- drivers/media/i2c/rdacm21.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c index 41d4242a9b583..ece8a410e7ced 100644 --- a/drivers/media/i2c/rdacm21.c +++ b/drivers/media/i2c/rdacm21.c @@ -588,13 +588,14 @@ static int rdacm21_probe(struct i2c_client *client) =20 ret =3D v4l2_async_register_subdev(&dev->sd); if (ret) - goto error_free_ctrls; + goto error_entity_cleanup; =20 return 0; =20 +error_entity_cleanup: + media_entity_cleanup(&dev->sd.entity); error_free_ctrls: v4l2_ctrl_handler_free(&dev->ctrls); - media_entity_cleanup(&dev->sd.entity); error: i2c_unregister_device(dev->isp); =20 --=20 2.50.1 (Apple Git-155)