From patchwork Wed Dec 6 16:38:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Ceolin X-Patchwork-Id: 10096485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8D6F460210 for ; Wed, 6 Dec 2017 16:39:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F36128AFC for ; Wed, 6 Dec 2017 16:39:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73F4628C87; Wed, 6 Dec 2017 16:39:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 002AC28AFC for ; Wed, 6 Dec 2017 16:39:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752192AbdLFQjV (ORCPT ); Wed, 6 Dec 2017 11:39:21 -0500 Received: from mga05.intel.com ([192.55.52.43]:31170 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbdLFQjU (ORCPT ); Wed, 6 Dec 2017 11:39:20 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Dec 2017 08:39:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,368,1508828400"; d="scan'208";a="11110562" Received: from faceolin-mobl2.amr.corp.intel.com ([10.254.118.233]) by fmsmga001.fm.intel.com with ESMTP; 06 Dec 2017 08:39:16 -0800 From: Flavio Ceolin To: linux-kernel@vger.kernel.org Cc: Flavio Ceolin , Mauro Carvalho Chehab , Hans Verkuil , Petr Cvek , Sakari Ailus , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Laurent Pinchart , Julia Lawall , Arnd Bergmann , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)) Subject: [PATCH] media: pxa_camera: disable and unprepare the clock source on error Date: Wed, 6 Dec 2017 08:38:50 -0800 Message-Id: <20171206163852.8532-1-flavio.ceolin@intel.com> X-Mailer: git-send-email 2.9.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pxa_camera_probe() was not calling pxa_camera_deactivate(), responsible to call clk_disable_unprepare(), on the failure path. This was leading to unbalancing source clock. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Flavio Ceolin Reviewed-by: Laurent Pinchart --- drivers/media/platform/pxa_camera.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index 9d3f0cb..7877037 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -2489,7 +2489,7 @@ static int pxa_camera_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, pcdev); err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev); if (err) - goto exit_free_dma; + goto exit_deactivate; pcdev->asds[0] = &pcdev->asd; pcdev->notifier.subdevs = pcdev->asds; @@ -2525,6 +2525,8 @@ static int pxa_camera_probe(struct platform_device *pdev) v4l2_clk_unregister(pcdev->mclk_clk); exit_free_v4l2dev: v4l2_device_unregister(&pcdev->v4l2_dev); +exit_deactivate: + pxa_camera_deactivate(pcdev); exit_free_dma: dma_release_channel(pcdev->dma_chans[2]); exit_free_dma_u: