From patchwork Mon Nov 20 10:45:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10066285 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 93979602B7 for ; Mon, 20 Nov 2017 10:46:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8464A2915D for ; Mon, 20 Nov 2017 10:46:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7903029163; Mon, 20 Nov 2017 10:46:27 +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 F174229169 for ; Mon, 20 Nov 2017 10:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750764AbdKTKqB (ORCPT ); Mon, 20 Nov 2017 05:46:01 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:47033 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750962AbdKTKp5 (ORCPT ); Mon, 20 Nov 2017 05:45:57 -0500 Received: by mail-lf0-f67.google.com with SMTP id g35so9493915lfi.13; Mon, 20 Nov 2017 02:45:56 -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=kLDNFDn0CJkqmKSoCyFg4OGkbKwVMyroZePC3OLMY/ZrO9grEcyP45cxcZbj5+5NXa XEPepqu+JML+fjYPKvGilKmiDHTkhu8NcancyKMSir9Uj3hPEyCiZWz1wq97nWPIeBop YrmAQocbtXu7TxB2Ptl2lTkM1abzzv4WE7YdHfK0cpb9yb5XhNFANj3308cHNf/ygQuj 4lNgo1EhRj0+7+EO+S/cp8mcn8+DfZB0NbfRFuoqU80YIA4Pssry5evH/LnMImPI7UwJ n1wkisvsutFxXjv4YVksXtOVS6NR9JWDcGNC6CiYosngU5HbFuE94a4gRLrFrhvdJE9O kv3Q== 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=dZv/8VUJR/RIQVmb0jOjTGyIinYzzAgrJ/qwguehqs7gkF5PXFnFy58I/fJ0eJY+Bl 1c6/+Od3+Djz54K8EH5NUWN+t486387sjCFPEAFybjMPtc6rxa2PVrqjvBwvfhmnHegd c8bogj997XxkabEb5wtqHIC4grzr977eWvRweb5ewGy/J+OTM3rpQhqpq19bpBXRk2Jc Pzfb5hL7t4ahuNGT2+nSsQZi++rMYhXJG9UgxlIQ0+yohd1uyx0y0sDU0u6EGhpV5MLo L6jyv6lShZpW5pUx7crwmpVPjZ8zpzZB729WuVgWcQXsADTKqf7DYkBGHNB9X52b6WYh qQbw== X-Gm-Message-State: AJaThX5mz1SRvQSgwIrSFWr2ZzNqf37L05EWMxrD6U53GeEi1DiBGqXM xgGmr83NJr/3tQmI/Rsmx38= X-Google-Smtp-Source: AGs4zMYMy/SsIT7TVng5/M0oTmx2wHGMgSzuhdfNpxUdV7LFLeNyVi4LuGiM2VZ2kDg+/NuYGNNyaQ== X-Received: by 10.25.67.86 with SMTP id m22mr1835931lfj.69.1511174756026; Mon, 20 Nov 2017 02:45:56 -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 d1sm2495510ljf.66.2017.11.20.02.45.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 02:45:53 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1eGjaK-0000hb-1w; Mon, 20 Nov 2017 11:45:52 +0100 From: Johan Hovold To: Lee Jones Cc: Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Qing Xu , Haojian Zhuang Subject: [PATCH v2 2/4] backlight: max8925_bl: fix device-tree node lookup Date: Mon, 20 Nov 2017 11:45:45 +0100 Message-Id: <20171120104547.2639-3-johan@kernel.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171120104547.2639-1-johan@kernel.org> References: <20171120104547.2639-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; }