From patchwork Tue Jul 30 12:25:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2835603 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9DDBCC0319 for ; Tue, 30 Jul 2013 12:26:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B45B20317 for ; Tue, 30 Jul 2013 12:26:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5D6D20306 for ; Tue, 30 Jul 2013 12:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752876Ab3G3M01 (ORCPT ); Tue, 30 Jul 2013 08:26:27 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:54822 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753400Ab3G3MZk (ORCPT ); Tue, 30 Jul 2013 08:25:40 -0400 Received: from axis700.grange (dslb-094-220-155-198.pools.arcor-ip.net [94.220.155.198]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0LbTPL-1UNMT32i8R-00lDVG; Tue, 30 Jul 2013 14:25:38 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 2D46040BB6 for ; Tue, 30 Jul 2013 14:25:38 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1V48zh-0003vL-VR for linux-media@vger.kernel.org; Tue, 30 Jul 2013 14:25:37 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Subject: [PATCH 4/6] V4L2: mt9t031: don't Oops if asynchronous probing is attempted Date: Tue, 30 Jul 2013 14:25:36 +0200 Message-Id: <1375187137-15045-6-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1375187137-15045-1-git-send-email-g.liakhovetski@gmx.de> References: <1375187137-15045-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:RQyxSu2vop2eg8rlmsMvu948SdlbgRvV5k7bV+2WFkW 3W11U/qKZDP7HmnI2nPHOMl8xdXcIfoXQMb4fLLf9n5UDtnYfR loQK2t1lJ1meh5UYGVR26Uh4mkpW5Y40+sVbHGuoRu7COhLYGG GmuIycvbjgv3A6h6aZXfZA+Chml8fst+LwXqMePVMARsl40OMq 525hv+2uO6x/i8j+TN1WEsQfYXVi9HZEfKphflMj/zTg+MIr+K b86KLVRvJlIDezPdwlyczMO5UCOYNpwIH0kuZUk/sXm1YpQhhQ 7t73oGv8DXgxU9dWoFPoGkiuZvqKs/HvwEEcSRDW6JYhVbV5l8 9Ptkc5DwnZ/EMBcE6VeHqifpMtj37jQpUAhl8bLm7SkFJm4b21 3jy6cX8unDTbA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The mt9t031 driver hasn't yet been updated to support asynchronous subdevice probing. If such a probing is attempted, the driver is allowed to fail, but it shouldn't Oops. This patch fixes such a potential NULL pointer dereference. Signed-off-by: Guennadi Liakhovetski --- drivers/media/i2c/soc_camera/mt9t031.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/soc_camera/mt9t031.c b/drivers/media/i2c/soc_camera/mt9t031.c index 47d18d0..ee7bb0f 100644 --- a/drivers/media/i2c/soc_camera/mt9t031.c +++ b/drivers/media/i2c/soc_camera/mt9t031.c @@ -594,9 +594,12 @@ static int mt9t031_s_power(struct v4l2_subdev *sd, int on) ret = soc_camera_power_on(&client->dev, ssdd, mt9t031->clk); if (ret < 0) return ret; - vdev->dev.type = &mt9t031_dev_type; + if (vdev) + /* Not needed during probing, when vdev isn't available yet */ + vdev->dev.type = &mt9t031_dev_type; } else { - vdev->dev.type = NULL; + if (vdev) + vdev->dev.type = NULL; soc_camera_power_off(&client->dev, ssdd, mt9t031->clk); }