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: 10067745 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 267B36022E for ; Tue, 21 Nov 2017 08:39:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 128A828F43 for ; Tue, 21 Nov 2017 08:39:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 072FC28F85; Tue, 21 Nov 2017 08:39:25 +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 C81B228F43 for ; Tue, 21 Nov 2017 08:39:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61B2B6E36B; Tue, 21 Nov 2017 08:39:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x244.google.com (mail-lf0-x244.google.com [IPv6:2a00:1450:4010:c07::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id C60D26E169 for ; Mon, 20 Nov 2017 10:45:57 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id m1so9514547lfj.9 for ; Mon, 20 Nov 2017 02:45:57 -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=jR3Vq/hH9/Fbz094dW14k2FvJi4AfPaVKB3Y0X04WqWv82SFfS9CEadgPtM1DLZRB9 HFD5oyuuYsz5SZXhsWNtLVqxg8ZH1ASt/XMJHhujRgeMKDXv4wvYhCF5gB8olMJRpUl+ pygt00bpd9vfYnY6rysbBPd1oY4C1eHxQ0rPAcwhgcsquhIw5UVt3CZGgyX4K/R8i6eh sqrlpFOkLBfYEuaxF2lSAzHhBCVQnOHSKI/DnUgKztXyTQYrKwZe6KmusPQzBiz2Y91S an7nZS0r6+W76kiq+a47d9qyiMR5vNyD49inWGzgI9rxBqDa7RDDXPrPPTL9Cfs5AzEh tPAA== X-Gm-Message-State: AJaThX4p8wkRpfGgGG+ln3N0RJJxB7YyeTajqTHBvHlD4RtH2JcBSlHl 8YDeeGrBAeMcVcNta5g9gTs= 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 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> X-Mailman-Approved-At: Tue, 21 Nov 2017 08:39:20 +0000 Cc: Daniel Thompson , Qing Xu , Bartlomiej Zolnierkiewicz , Jingoo Han , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Johan Hovold , 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; }