Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp203448pxk; Fri, 11 Sep 2020 04:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQoiuooJgN76PnQzqEIS9Hz9uOyM4IBG6gz4j9UEEWiDngCR16HQIl3/SQ+ZPqkRpEotO/ X-Received: by 2002:a50:cbc7:: with SMTP id l7mr1511195edi.148.1599824574730; Fri, 11 Sep 2020 04:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599824574; cv=none; d=google.com; s=arc-20160816; b=muy2qrlr7kGaGjYegMIzqPUHEKOg3YFhVpYGEMQeiU98iwKmkA8eb3pwLlVdWbtTEu qIXurJqYrGPP+faa97W9e0rN04TyLcFyVLrq/iBOdYkH2Wz2z+NtT4svrvg/+K39FWwr 983dc5gauAub7QEfypIyfaNDlxJNqL+U86EM3xxa5GcLmYvBq+kq2Oy/duo9S2PTCfHA gSkHo3tWwM8thaNrCBfjCXR5pOAkD9+8JGPnwVfBkcXETH0VSYdZJFPLk4E5A19nhlw8 76N1l8LO/mDZlt5BcU1Bxa28OqGvPmpiMyKCIbn8vLf+9NKAbF5rotuhaRUqwlzdVMfy qimw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=dSa61EBNp5jk0MCrvfRonQsFawYzIvTk/N6tpdVRAyk=; b=xkklElsJQnJKT6902dY6005YEUrhkan5aoYmPGjGzFkJXsKh9kNLG0m7NiLqUuNYJS uX21ZoIH0iot8wHD6ljvAiP7tJlY9jDUV4k8rxx7fEGf1I/oQRd3+rhxrszgTvCcqlrR TQQ7rgZ2gVrE9aNRf4nCp+nJVoWNnXgILKB6YSY+z0BjDIAg0dHfKzGTZx8qZw9Gfhq+ IcDX/mIgoh8buhdGd0MlSqYKqkxWfFuBtFx8yG5AWDIOAVXsJ2VkYAC5SkgD/zDJUnGx tp6nL2qlFQ0AI2qb/BqA24ZIMu9UAbM41+NaJwICyx8qSKjfcRkjj2Hks+MyuTalcGdV 1qHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si1076601edm.281.2020.09.11.04.42.31; Fri, 11 Sep 2020 04:42:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725817AbgIKLkh (ORCPT + 99 others); Fri, 11 Sep 2020 07:40:37 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:44842 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725774AbgIKLi6 (ORCPT ); Fri, 11 Sep 2020 07:38:58 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 852E8207FBD92955F13B; Fri, 11 Sep 2020 19:22:39 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Fri, 11 Sep 2020 19:22:32 +0800 From: Yu Kuai To: , , , , , , CC: , , , , , Subject: [PATCH] drm/mediatek: add missing put_device() call in mtk_hdmi_dt_parse_pdata() Date: Fri, 11 Sep 2020 19:21:51 +0800 Message-ID: <20200911112151.3220469-1-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org if of_find_device_by_node() succeed, mtk_drm_kms_init() doesn't have a corresponding put_device(). Thus add jump target to fix the exception handling for this function implementation. Fixes: 8f83f26891e1 ("drm/mediatek: Add HDMI support") Signed-off-by: Yu Kuai --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index f2e9b429960b..a97725680d4e 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1507,25 +1507,30 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, dev_err(dev, "Failed to get system configuration registers: %d\n", ret); - return ret; + goto put_device; } hdmi->sys_regmap = regmap; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); hdmi->regs = devm_ioremap_resource(dev, mem); - if (IS_ERR(hdmi->regs)) - return PTR_ERR(hdmi->regs); + if (IS_ERR(hdmi->regs)) { + ret = PTR_ERR(hdmi->regs); + goto put_device; + } remote = of_graph_get_remote_node(np, 1, 0); - if (!remote) - return -EINVAL; + if (!remote) { + ret = -EINVAL; + goto put_device; + } if (!of_device_is_compatible(remote, "hdmi-connector")) { hdmi->next_bridge = of_drm_find_bridge(remote); if (!hdmi->next_bridge) { dev_err(dev, "Waiting for external bridge\n"); of_node_put(remote); - return -EPROBE_DEFER; + ret = -EPROBE_DEFER; + goto put_device; } } @@ -1534,7 +1539,8 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n", remote); of_node_put(remote); - return -EINVAL; + ret = -EINVAL; + goto put_device; } of_node_put(remote); @@ -1542,10 +1548,14 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, of_node_put(i2c_np); if (!hdmi->ddc_adpt) { dev_err(dev, "Failed to get ddc i2c adapter by node\n"); - return -EINVAL; + ret = -EINVAL; + goto put_device; } return 0; +put_device: + put_device(hdmi->cec_dev); + return ret; } /* -- 2.25.4