From patchwork Mon Jun 10 13:57:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 166323 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1063287ilk; Mon, 10 Jun 2019 06:58:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqycMPcN0oU/HNXYHo51wkoLm+Nj0q7UEJB81lhui+clBV0xrJM6GwsCvs7Q3ngfJI2paWqz X-Received: by 2002:a65:510c:: with SMTP id f12mr15165694pgq.92.1560175094539; Mon, 10 Jun 2019 06:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560175094; cv=none; d=google.com; s=arc-20160816; b=pKQ2tj0zWhAhFTxoQwl0sqjY1c8M1oRDMgrs2diNOahV3Vq68RYXdAemDBCEvmL9fo PxDnNF/7Sx5fcj2Le+grdRC0Ghz752GLHtPigw98wMtsP3RjitVnRc5mL0ISjMo+3xOY +pQ2jFqAKyhEa/wF95CH87h/hYt8m+n4VV94s0ResxAkoIXeez3P7BtfzFEueTi1frWi 2NWaTovV0S4RwoVJ1ey6YEb3MGv5zfYVLtfgi5AxNXjsQbdo4STXEJsoFWuuD6IFXus5 pHooI48YZmLgVHx/gkAWEsE1wlRhlHdzf02YiFuF58I55MS0HSNs4YRwRV/NUWmK5dSf LCnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=2jBIJKJUZuMCn+WHIL+nQyizf1dXn4gFm7o/6X2Ufhs=; b=HF3kX2W1khTILo40pBT/RLVd4BVPPpbR+S+fjzF4Njm6jsUkLBBhmNNXrKnvXx7Mo1 WchemOpDbEhLNODPYwfmZIAaq2qxf7gF/dlyIrV+CgdQtlrUg3pJpP34Yr7AILziIDgp PubyEoBPvCOWMXaNUchYe8R7z0MgNu8Qjj2mhIKn/QkSgToJQO2XuZMkJQxx6ZpcHdPi zFWUmkoiAGg2E0BQ+fc12sg2HLGdWRidDyHvrWm5mSmpboNuFc+JbUntOWKcDjwDQvml Yh+oGWxPPDJqsWKxj9XTmMVG3mg/r14Ei7jmxUm2ConsB/HgtlzcfrHgEyxc7rxNMhQq uMnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id j71si3281406pgd.167.2019.06.10.06.58.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jun 2019 06:58:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 686B2890BA; Mon, 10 Jun 2019 13:58:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id DBF99890BC for ; Mon, 10 Jun 2019 13:58:12 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5ADw7tt009370; Mon, 10 Jun 2019 08:58:07 -0500 Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5ADw7jW109920 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 08:58:07 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 10 Jun 2019 08:58:07 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 10 Jun 2019 08:58:07 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5ADw5A4031652; Mon, 10 Jun 2019 08:58:06 -0500 From: Tomi Valkeinen To: , Laurent Pinchart , Andrzej Hajda Subject: [PATCH 1/2] drm/bridge: tfp410: fix memleak in get_modes() Date: Mon, 10 Jun 2019 16:57:38 +0300 Message-ID: <20190610135739.6077-1-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560175087; bh=4ayWUuZoKTT/b0/9sHrkudRNq5ozR8xs+hB5DL6czMA=; h=From:To:CC:Subject:Date; b=bx3dL1AkqHBUcb+qcjEAHuBk4k/4ENDj4ZjWL1ULH2oUW/jYQew7dL9wlhDHzECyU BL9QNzGCgS6dWGKmAELJSuhTiYMAZ1/VOKbjufpuq9M2wfUUW06WUwDr53mWs+rCqy WaZB6QW37rs394nyJAHJY+HaCK15mEg344faFzpw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We don't free the edid blob allocated by the call to drm_get_edid(), causing a memleak. Fix this by calling kfree(edid) at the end of the get_modes(). Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/ti-tfp410.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index 8b0e71bd3ca7..9f0836cc712b 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -70,7 +70,12 @@ static int tfp410_get_modes(struct drm_connector *connector) drm_connector_update_edid_property(connector, edid); - return drm_add_edid_modes(connector, edid); + ret = drm_add_edid_modes(connector, edid); + + kfree(edid); + + return ret; + fallback: /* No EDID, fallback on the XGA standard modes */ ret = drm_add_modes_noedid(connector, 1920, 1200);