From patchwork Thu Jul 1 17:21:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 109191 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o61HMJQ7004995 for ; Thu, 1 Jul 2010 17:22:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752050Ab0GARVw (ORCPT ); Thu, 1 Jul 2010 13:21:52 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:43184 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751556Ab0GARVw (ORCPT ); Thu, 1 Jul 2010 13:21:52 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 4407F1C001B4; Thu, 1 Jul 2010 19:21:50 +0200 (CEST) X-Auth-Info: /kP1rwwUC76nK+p/QuZAwYJ0xWuiOEbQyspQAth8d9E= Received: from localhost (p578FAE18.dip.t-dialin.net [87.143.174.24]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 14FA61C003CB; Thu, 1 Jul 2010 19:21:50 +0200 (CEST) From: Anatolij Gustschin To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Detlev Zundel , Anatolij Gustschin Subject: [PATCH] V4L/DVB: v4l2-dev: fix memory leak Date: Thu, 1 Jul 2010 19:21:39 +0200 Message-Id: <1278004899-16940-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.0.4 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]); Thu, 01 Jul 2010 17:22:19 +0000 (UTC) diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 0ca7ec9..9e89bf6 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -410,7 +410,7 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, int minor_offset = 0; int minor_cnt = VIDEO_NUM_DEVICES; const char *name_base; - void *priv = video_get_drvdata(vdev); + void *priv = vdev->dev.p; /* A minor value of -1 marks this video device as never having been registered */ @@ -536,9 +536,9 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, /* Part 4: register the device with sysfs */ memset(&vdev->dev, 0, sizeof(vdev->dev)); - /* The memset above cleared the device's drvdata, so + /* The memset above cleared the device's device_private, so put back the copy we made earlier. */ - video_set_drvdata(vdev, priv); + vdev->dev.p = priv; vdev->dev.class = &video_class; vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor); if (vdev->parent)