From patchwork Tue Feb 9 11:59:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 78008 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o19Br6Ht028442 for ; Tue, 9 Feb 2010 11:53:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753447Ab0BILwa (ORCPT ); Tue, 9 Feb 2010 06:52:30 -0500 Received: from mail-ew0-f228.google.com ([209.85.219.228]:46385 "EHLO mail-ew0-f228.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752602Ab0BILw3 (ORCPT ); Tue, 9 Feb 2010 06:52:29 -0500 Received: by ewy28 with SMTP id 28so3682486ewy.28 for ; Tue, 09 Feb 2010 03:52:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=XYuwncgesrZQkYs91QtMsi6vrmKXptP5JaTrADBKpg8=; b=tQvCpA5Xjzlrp5/TpXlk4ALgSf+L3BxeZShaiZNe+7sNPbCWh0QcEJxLBdSqSvmiGV 9tFezjvnCKNpKxVs34udG+Jx56TtdbvulrFv0zySp9aOjcrA39ZdVnZJ+AVoy9stGVvS Yw7jibdb/WSVkwjf5VGjcZss+NPzI7i8fOqOQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=LDf0qADbVYMjmhYA47hJssT42kV1E0fty05mAxXUiUoPlJGiaxR7X9BBwMJFXmu7/a F1zEKmusun2ZQ5FuDZamlFP2c5mL1YFzD83nJvll1R5owFO8OmGbbaUbvdZVBbae/puB pJpghFXmD/D7fX+qXT8edmRy2ugWGZPi5AoAg= Received: by 10.213.1.209 with SMTP id 17mr5068711ebg.70.1265716347335; Tue, 09 Feb 2010 03:52:27 -0800 (PST) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm82986eyb.2.2010.02.09.03.52.26 (version=SSLv3 cipher=RC4-MD5); Tue, 09 Feb 2010 03:52:26 -0800 (PST) Message-ID: <4B714E15.4020909@gmail.com> Date: Tue, 09 Feb 2010 12:59:17 +0100 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc12 Thunderbird/3.0.1 MIME-Version: 1.0 To: Mauro Carvalho Chehab , linux-media@vger.kernel.org, Andrew Morton , LKML Subject: [PATCH] video_device: don't free_irq() an element past array vpif_obj.dev[] and fix test Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 09 Feb 2010 11:53:06 +0000 (UTC) diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index dfddef7..8f6605d 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c @@ -383,7 +383,7 @@ static int vpif_get_std_info(struct channel_obj *ch) int index; std_info->stdid = vid_ch->stdid; - if (!std_info) + if (!std_info->stdid) return -1; for (index = 0; index < ARRAY_SIZE(ch_params); index++) { @@ -1423,7 +1423,7 @@ static __init int vpif_probe(struct platform_device *pdev) { struct vpif_subdev_info *subdevdata; struct vpif_display_config *config; - int i, j = 0, k, q, m, err = 0; + int i, j = 0, k, m, err = 0; struct i2c_adapter *i2c_adap; struct common_obj *common; struct channel_obj *ch; @@ -1573,10 +1573,12 @@ probe_out: video_device_release(ch->video_dev); ch->video_dev = NULL; } + if (k == VPIF_DISPLAY_MAX_DEVICES) + k = VPIF_DISPLAY_MAX_DEVICES - 1; vpif_int_err: v4l2_device_unregister(&vpif_obj.v4l2_dev); vpif_err("VPIF IRQ request failed\n"); - for (q = k; k >= 0; k--) { + for (; k >= 0; k--) { for (m = i; m >= res->start; m--) free_irq(m, (void *)(&vpif_obj.dev[k]->channel_id)); res = platform_get_resource(pdev, IORESOURCE_IRQ, k-1);