From patchwork Mon Jan 13 10:19:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitalii Mordan X-Patchwork-Id: 857109 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 528EC1FDA69; Mon, 13 Jan 2025 10:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.149.199.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736763565; cv=none; b=Gb0ZmffZb/t96il8rB5lx1Ljw73ZbOldq4ph3RmEXBUjSEAAxePDCkYOakzEbWzDVup2OXUH80VWVGp6Kwey/wtzQSbv2Y2o0d1CBOF2DjcoyheLW2oa9o3L3CXFcMvUuFMzOfytFbKHb9JIBmrS/TaQisgXKKAhU+EyTiybYVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736763565; c=relaxed/simple; bh=Atf8vMRZ9EIMzjhuE4SCf4QiTTMAuk7esCjrBpXl310=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=eBvLKYxDHITEZJ0pAhl+t37SNuC1Cu6VwoQ9he55WSalmpWBE3wqzF1jyMhyUed0AbOB48zXmYpMpgKXVI7/KcLoPP+i8nZRXwG8+U70qTTw1UExMfYl+vadbXxnzKuUkjurMpDiak4jyhcrP/Cc9Ms/80REX11lYwxzGXW7jlQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru; spf=pass smtp.mailfrom=ispras.ru; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b=iNSZItZ8; arc=none smtp.client-ip=83.149.199.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ispras.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="iNSZItZ8" Received: from ldvnode.intra.ispras.ru (unknown [10.10.2.153]) by mail.ispras.ru (Postfix) with ESMTPSA id 5E91E40769AC; Mon, 13 Jan 2025 10:19:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 5E91E40769AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1736763561; bh=AtvRmghQBumH5Uo/aCVKY22UwzEZ3zBckU0U0TF6LD0=; h=From:To:Cc:Subject:Date:From; b=iNSZItZ8utqaElptShFKvDnVQ74DEjt1cPA8qB5Z3tY3Ux+1kWIZn5Lfi27CRHxTt sE+39s4qOHlnu6wqo5PGfcdwud/xznIeXfgrQ1SVZU/WCm0v7S9EDZmiGRtjFHTUZt OODC28/pmUTSFjfvCwQ9Rd5mwxCm2kuAb7MECiAA= From: Vitalii Mordan To: Jacopo Mondi Cc: Vitalii Mordan , Sakari Ailus , Mauro Carvalho Chehab , Kuninori Morimoto , Guennadi Liakhovetski , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Fedor Pchelkin , Alexey Khoroshilov , Vadim Mutilin , stable@vger.kernel.org Subject: [PATCH] media: mt9t112: fix error handling in mt9t112_camera_probe Date: Mon, 13 Jan 2025 13:19:14 +0300 Message-Id: <20250113101914.2441210-1-mordan@ispras.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The macro mt9t112_reg_read returns from mt9t112_camera_probe() in case of an error. However, a call to the shutdown function mt9t112_s_power() is required at this point. Failure to execute the shutdown function will result in the priv->clk not being properly disabled. Found by Linux Verification Center (linuxtesting.org) with Klever. Fixes: 858424b998ae ("V4L/DVB (13670): soc-camera: Add mt9t112 camera driver") Cc: stable@vger.kernel.org Signed-off-by: Vitalii Mordan --- drivers/media/i2c/mt9t112.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/mt9t112.c b/drivers/media/i2c/mt9t112.c index 878dff9b7577..82e2c42f4c7b 100644 --- a/drivers/media/i2c/mt9t112.c +++ b/drivers/media/i2c/mt9t112.c @@ -1034,7 +1034,11 @@ static int mt9t112_camera_probe(struct i2c_client *client) return ret; /* Check and show chip ID. */ - mt9t112_reg_read(chipid, client, 0x0000); + chipid = __mt9t112_reg_read(client, 0x0000); + if (chipid < 0) { + ret = chipid; + goto done; + } switch (chipid) { case 0x2680: