From patchwork Tue Feb 9 16:15:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 78058 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 o19GFc5j019660 for ; Tue, 9 Feb 2010 16:15:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754680Ab0BIQPh (ORCPT ); Tue, 9 Feb 2010 11:15:37 -0500 Received: from perceval.irobotique.be ([92.243.18.41]:60470 "EHLO perceval.irobotique.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754581Ab0BIQPh (ORCPT ); Tue, 9 Feb 2010 11:15:37 -0500 Received: from localhost.localdomain (167.47-240-81.adsl-dyn.isp.belgacom.be [81.240.47.167]) by perceval.irobotique.be (Postfix) with ESMTPSA id 04567359AB; Tue, 9 Feb 2010 16:15:32 +0000 (UTC) From: Laurent Pinchart To: mchehab@infradead.org Cc: linux-media@vger.kernel.org, hverkuil@xs4all.nl, sakari.ailus@maxwell.research.nokia.com Subject: [PATCH] v4l: Fix a memory leak caused by zeroing struct device Date: Tue, 9 Feb 2010 17:15:30 +0100 Message-Id: <1265732130-17929-1-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.6.4.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]); Tue, 09 Feb 2010 16:15:38 +0000 (UTC) diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 13a899d..1fec852 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -412,7 +412,6 @@ 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); /* A minor value of -1 marks this video device as never having been registered */ @@ -536,10 +535,6 @@ 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 - put back the copy we made earlier. */ - video_set_drvdata(vdev, priv); vdev->dev.class = &video_class; vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor); if (vdev->parent)