From patchwork Mon Nov 13 10:20:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10056343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8CDBB60365 for ; Mon, 13 Nov 2017 15:48:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F2BF292A1 for ; Mon, 13 Nov 2017 15:48:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73F4929321; Mon, 13 Nov 2017 15:48:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EBD22922B for ; Mon, 13 Nov 2017 15:48:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4425B6E65F; Mon, 13 Nov 2017 15:48:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A33F6E547 for ; Mon, 13 Nov 2017 10:20:50 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id r135so17687147lfe.5 for ; Mon, 13 Nov 2017 02:20:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=2XwxhEe/8vM2LkbyhzyXo0FO8p4j7YtPeHCdvH9hzYk=; b=dDrDbOjjm/MSg/3KHxKX9VHCrtu1/v+w7kSpfIc1KbgRS/vcjH7TbTqp8uWvE++x08 Nbe9nqU+Wx6jQYjS+l+xgqKgCBwcD6rZa+eWNUsZ5eImqF4LRiXzC2i0VJiOuUyvfwbH Mb0LV53AZ415W6lTUeFt8M8sp00KVjApty3Gcna+KsNLqwVq4snpVvpXOt9WEIRZqH0V smyoFbGAvIIXlSRpBrQshCTvCvkRqXB24DSv2evtknfcT4qpMi3ELXzUlaM2XULGUgJI 2mLHs3kUdpPQdJKm8kBH7TUOXxl5uU9hI4+l4vH5wVAMw5P0UaAXiXmA9ZRT/5d0l8F+ HbsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=2XwxhEe/8vM2LkbyhzyXo0FO8p4j7YtPeHCdvH9hzYk=; b=dL2J4rcxJnoXntKRLNQqo+0O8luDGcGBF4g0L1GE9pWQzmvnxDC/rh9pRHZ6syO86X aExkb/2B/Ce2sIYmz31+f4NZeEQc0qasFHFvM6o4VvaWj5X/A96PlYmjkKKQ919dFG+e rGqVtuJCyweNIGWp7EsU+E9YcntZophLKe5DVaq5SRg3KjYyi10peJxyK4Xqktrou2hY xVV7Jur/DJBuqAdH71+oN3be3pqZ14HH/1z5fbBr92QDe99WyFuAT3QQ8vkNNgCJB9Vf BMGCypAy9yz8XEMpLWnj2P/fQooXpThaXezoTaIQFgD++8NGL+PG5RdOMA9nwjZrz5py 18Ug== X-Gm-Message-State: AJaThX6xhEJnNVxmRvAroP9ci5vrTFcIcgnShXLjiElHAGd1jTRDthCg syEvtdx/0ct0opjPJE0KS08= X-Google-Smtp-Source: AGs4zMbf5u9bY5CPdjLp5HQXIgGsZu/dnqEs585eJ6RUYeczGHMhaT4mXPVnvKWj+InpG8q5ScTfQA== X-Received: by 10.46.21.78 with SMTP id 14mr3427612ljv.47.1510568449138; Mon, 13 Nov 2017 02:20:49 -0800 (PST) Received: from xi.terra (c-c0bae655.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.230.186.192]) by smtp.gmail.com with ESMTPSA id e195sm2842872lfg.5.2017.11.13.02.20.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Nov 2017 02:20:48 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1eEBrK-0002RU-BS; Mon, 13 Nov 2017 11:20:54 +0100 From: Johan Hovold To: Lee Jones Subject: [PATCH 2/3] backlight: max8925_bl: fix device-tree node lookup Date: Mon, 13 Nov 2017 11:20:48 +0100 Message-Id: <20171113102049.9342-2-johan@kernel.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113102049.9342-1-johan@kernel.org> References: <20171113102049.9342-1-johan@kernel.org> X-Mailman-Approved-At: Mon, 13 Nov 2017 15:48:14 +0000 Cc: Daniel Thompson , Qing Xu , Jingoo Han , Johan Hovold , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Haojian Zhuang , stable , linux-fbdev@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Fix child-node lookup during probe, which ended up searching the whole device tree depth-first starting at the parent rather than just matching on its children. To make things worse, the parent mfd node was also prematurely freed, while the child backlight node was leaked. Fixes: 47ec340cb8e2 ("mfd: max8925: Support dt for backlight") Cc: stable # 3.9 Cc: Qing Xu Cc: Haojian Zhuang Signed-off-by: Johan Hovold --- drivers/video/backlight/max8925_bl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 7b738d60ecc2..f3aa6088f1d9 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -116,7 +116,7 @@ static void max8925_backlight_dt_init(struct platform_device *pdev) if (!pdata) return; - np = of_find_node_by_name(nproot, "backlight"); + np = of_get_child_by_name(nproot, "backlight"); if (!np) { dev_err(&pdev->dev, "failed to find backlight node\n"); return; @@ -125,6 +125,8 @@ static void max8925_backlight_dt_init(struct platform_device *pdev) if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val)) pdata->dual_string = val; + of_node_put(np); + pdev->dev.platform_data = pdata; }