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: 10055509 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 A93796029B for ; Mon, 13 Nov 2017 10:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 697F62934D for ; Mon, 13 Nov 2017 10:21:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E28F29361; Mon, 13 Nov 2017 10:21:26 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E16692934D for ; Mon, 13 Nov 2017 10:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752177AbdKMKUx (ORCPT ); Mon, 13 Nov 2017 05:20:53 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:52747 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751576AbdKMKUu (ORCPT ); Mon, 13 Nov 2017 05:20:50 -0500 Received: by mail-lf0-f67.google.com with SMTP id m1so1693980lfj.9; Mon, 13 Nov 2017 02:20:49 -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=A1X5njN1mBrFq+/1KTnj8On4Fb3PiRzil5CueXkQGUnz3EkqVZyWUp6kQEFZ/ePC3g Asl/EDWoUKoW+ZN+q4dvKPkX87kmba4q7bm+c96OgjZ/uuAZN0URObpQhXIy79cZ9MJR nXgUX2ts4u+dR2ov5C1ndRzWjw3HHC2Zf7pB+bSA3dmFkc95mug3vaLlXx6pHi70sTEA 057XNh0f1REJaqMAuOnnYbbF6Y/MJXMfx9pZyjr5AhvTG4CrC8SXp7upb+gM0o4nP8DR JUmK6KphzpLT4lZNOo8Nmk8cSDEGH1iv1c5+GNx5Gr/PfRhVQJhdfTvJ7jyEd2UMnAMS bwdg== X-Gm-Message-State: AJaThX73iqAwvthjStSkZHiem+K2rYUrZPNYaLfOJFEbGIQM15Y1rkVH Z0vDyOg29kDu+tkm+keMNd4= 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 Cc: Daniel Thompson , Jingoo Han , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Qing Xu , Haojian Zhuang 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> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 Acked-by: Daniel Thompson --- 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; }