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); From patchwork Mon Jun 10 13:57:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 166324 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1063324ilk; Mon, 10 Jun 2019 06:58:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbAhUyRPWSuRPkREEc0/GKxlG0oP0FRKiCx1GxuKB+ykV9a0uH69U3f7Jz3TRT2y7gAlP0 X-Received: by 2002:a17:90a:9b8a:: with SMTP id g10mr13389307pjp.66.1560175096541; Mon, 10 Jun 2019 06:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560175096; cv=none; d=google.com; s=arc-20160816; b=YA6aB4YJEPPnExArCyihniIyNHGfUep6vJqCg3S55QGE5FGrnFSm2iGm6M8JNAzbJG ArOyDuq9r84K5iLc8NO7vQ3AdcRWuFgKnacYIZcWGIjyz6WOwIyBJVsuhkpwUt8MNfU2 YMubfjTxq982vaIhliRkctVBquqJrDEWvBEniNYPoF76c520h3zyog7iPXYvE9mJQ8O5 n1Mr5UGHG96PDQh2Q+xP558hZ+Bl9pZhP9FBa+Av49Y3QxkGefGLGBA5rEimgt+wAIRM X9TB+FXyQbX/48i/xBSRj2qYouUxZeX7/gYfQX4vs4bHPOMhoKalX7VJvoEXGKzKAsPh EgFA== 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:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=c0QkEZpR717HiYrzDaxlsX6CcxmsnGH1uoudRkqso2E=; b=ed1r+wMYAFXT6g+ilMcQYwMbycZxwcC/Za9UnxUJUTDePTyrrlPFYTOg/lgR+rGS3K AHEYv9h4Fne/0JZJWyCQSDj9jiguabqjxExRZiYwv+auiChJ6aa8Y1qozFkfxS8GTtaN YSV006yTWMXfsvgTXxabLi8KTDtHt0GR2vMqODi3ikNXKE7PvJq6XOluQg0OoSeN6kpI ZiDDMMwaJEJl/NsKnOoWVaYcPD8vCNG5sTK/L5MbtGlFWxAXGljlc4IM0+oNyeThvwBs 0rRVFyMhA3f0fAIJRQFirkGDmEBtCzJ/69wTJ9uQp2dahfqoHXvld4T9cxL4BPULxXaN f3mg== 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 131.252.210.177 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. [131.252.210.177]) by mx.google.com with ESMTPS id k8si10045006pgi.123.2019.06.10.06.58.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jun 2019 06:58:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 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 A1D54890BC; 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 fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by gabe.freedesktop.org (Postfix) with ESMTPS id B8B39890BA for ; Mon, 10 Jun 2019 13:58:12 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5ADw97q074708; Mon, 10 Jun 2019 08:58:09 -0500 Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5ADw9Ws038798 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 08:58:09 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE100.ent.ti.com (10.64.6.21) 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:08 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE104.ent.ti.com (10.64.6.25) 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:08 -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 x5ADw5A5031652; Mon, 10 Jun 2019 08:58:07 -0500 From: Tomi Valkeinen To: , Laurent Pinchart , Andrzej Hajda Subject: [PATCH 2/2] drm/bridge: tfp410: fix use of cancel_delayed_work_sync Date: Mon, 10 Jun 2019 16:57:39 +0300 Message-ID: <20190610135739.6077-2-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610135739.6077-1-tomi.valkeinen@ti.com> References: <20190610135739.6077-1-tomi.valkeinen@ti.com> 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=1560175089; bh=6Qnx1ZS6yDoLhsy9Pw/hbJgJ21lXELEXI5PTGbIoMVY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=sdNgQPOn2nSeN1Yx+CpjHCSDOUGWVcJCPoVBH/cX2RqosM1+E59UtE7D8lSKW5JYl ObD5DQmxfFjhO0EBPTDai3g/5DDpRaOx2826vKOIBD63DXp4avJpgpMioP+k9RiYqC c3GcPFnCbuqU0ucdQ17I/FEwEK5BI+Ws06foo/l8= 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 use delayed_work in HPD handling, and cancel any scheduled work in tfp410_fini using cancel_delayed_work_sync(). However, we have only initialized the delayed work if we actually have a HPD interrupt configured in the DT, but in the tfp410_fini, we always cancel the work, possibly causing a WARN(). Fix this by doing the cancel only if we actually had the delayed work set up. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/ti-tfp410.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index 9f0836cc712b..07b695172db2 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -381,7 +381,8 @@ static int tfp410_fini(struct device *dev) { struct tfp410 *dvi = dev_get_drvdata(dev); - cancel_delayed_work_sync(&dvi->hpd_work); + if (dvi->hpd_irq >= 0) + cancel_delayed_work_sync(&dvi->hpd_work); drm_bridge_remove(&dvi->bridge);