From patchwork Thu Apr 18 21:35:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2462591 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 34EE63FCA5 for ; Thu, 18 Apr 2013 21:36:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966149Ab3DRVgY (ORCPT ); Thu, 18 Apr 2013 17:36:24 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:55164 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936494Ab3DRVf7 (ORCPT ); Thu, 18 Apr 2013 17:35:59 -0400 Received: from axis700.grange (dslb-088-077-162-170.pools.arcor-ip.net [88.77.162.170]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LdKy1-1Utiaj3FdB-00iT6L; Thu, 18 Apr 2013 23:35:57 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 90A5040BCE; Thu, 18 Apr 2013 23:35:55 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1USwUl-0005dy-42; Thu, 18 Apr 2013 23:35:55 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Guennadi Liakhovetski Subject: [PATCH 18/24] V4L2: mt9p031: power down the sensor if no supported device has been detected Date: Thu, 18 Apr 2013 23:35:39 +0200 Message-Id: <1366320945-21591-19-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de> References: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:3pvWGSjuFlGj+gmP3d0o6e650kV3ptBfXjdW+N3Nssq yodO5pE2Y6Dh90l062MZaFuOgxhVRyTXIQL829hvC9H7jDu/F2 L0bfP2CZK3RnZ7SYvYfQKvZcgcSc929TNUmacCpeBXL+tYCDVg toAor/raSM+nSFei271D5QsX+hXIumkksz8kYjjFdxmTsIPxHM 4uThGYYyJ8AExOE32XIZ8UKk9VqqOdx8EGV3idof4TST+91jiv CetZHmhhzbgv7/CjU1sbnAWRgg4/rqB8wmEwhY5wGFTon0Sgbf 7pszPMVB2HMnDeqfaquzwTfKZEpaKRf5ASfUSfNyla1icvsDrK wDbmrIp0sVwjdT2EsOzVSZRP7hoiglYRLGtbzzWTaHjLSR9R0F G1QY3z53oUqDP1D88V3IvCfCEG31RwvjfA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The mt9p031 driver first accesses the I2C device in its .registered() method. While doing that it furst powers the device up, but if probing fails, it doesn't power the chip back down. This patch fixes that bug. Signed-off-by: Guennadi Liakhovetski --- drivers/media/i2c/mt9p031.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index eb2de22..70f4525 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -844,7 +844,7 @@ static int mt9p031_registered(struct v4l2_subdev *subdev) ret = mt9p031_power_on(mt9p031); if (ret < 0) { dev_err(&client->dev, "MT9P031 power up failed\n"); - return ret; + goto done; } /* Read out the chip version register */ @@ -852,13 +852,15 @@ static int mt9p031_registered(struct v4l2_subdev *subdev) if (data != MT9P031_CHIP_VERSION_VALUE) { dev_err(&client->dev, "MT9P031 not detected, wrong version " "0x%04x\n", data); - return -ENODEV; + ret = -ENODEV; } +done: mt9p031_power_off(mt9p031); - dev_info(&client->dev, "MT9P031 detected at address 0x%02x\n", - client->addr); + if (!ret) + dev_info(&client->dev, "MT9P031 detected at address 0x%02x\n", + client->addr); return ret; }