Received: by 10.223.164.202 with SMTP id h10csp3692294wrb; Mon, 20 Nov 2017 03:34:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMbw/J8hWH9wQRl0Z4cQJfnqbVtSMw06NVFVfXR+rFmAHDQ8XZqSwupbTlK1d7sjerPxZ2/O X-Received: by 10.84.224.131 with SMTP id s3mr13562020plj.39.1511177643583; Mon, 20 Nov 2017 03:34:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511177643; cv=none; d=google.com; s=arc-20160816; b=E66PFey/K26+0FJuAdkPNhvO5nUN6SkRb57gb4iMsHwX4bGAJBZ8EKdMdkkjUWFbiM CxUr1+TtevZuFcKb1Tu7UMJ7s/OfQUJ36ErJr+VzBIDw3GOPjyDgokn8opP9LLiVS3Oj urw6VBVZOYLfV8Mb4faenWBnxpaifgxJZgtde73lVErK0kdiDN1irVnl0TkB67ijnt61 +WTatxD9A5kiZh1kLsWIifvCBK1MjDbNq9c4RmAOK6X2Ey4VT82JHzSXYEURLoAvbSH+ wgWDw6/7zsppkyL3iwK/piawcgFf5MVC34stB6qMzynylH6Q2V2CIxx2zCO0RQ+JtT62 J2JA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=d9kZCln6GRDQn3nqqQpaHdbUBYky2JMtsbnOoWIz0N4=; b=k7NO10uOF67nvQyekjdqZcyETqTisw/p2zIIBQaTqBMGgDYvLiT+zWTmYgYzC8tK2z pRU1YZiAs+v0++JKoHhIJbpu43K1VQGskszyrwlp4EwIchnrZGvY8ww3jbqdYNWbC0X8 S0LQObZ2NL72H0BfbnGepgi37r8uE3csbf8yib9vTCuUH9aKkgPjSPgK3ecJeWWolMl3 MJvcXTt1T6wSuJX2FgPp38Ll5F/ApYW5++A3V72SUXHaOgFX4/EFPqpqC28pFLu3H7an fikBJKVIc819sGHBQCE9uHVX3YedTCZPlwiSaPpntUsqSt45sQTgWFTcpWSIcvDvjpEe o6hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hq83ZBzY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a33si8279219plc.180.2017.11.20.03.33.52; Mon, 20 Nov 2017 03:34:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hq83ZBzY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751128AbdKTLdL (ORCPT + 68 others); Mon, 20 Nov 2017 06:33:11 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:44701 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbdKTLdJ (ORCPT ); Mon, 20 Nov 2017 06:33:09 -0500 Received: by mail-wm0-f66.google.com with SMTP id r68so18204164wmr.3 for ; Mon, 20 Nov 2017 03:33:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=d9kZCln6GRDQn3nqqQpaHdbUBYky2JMtsbnOoWIz0N4=; b=Hq83ZBzYQcBzY1AY3eT/sS1Xo5ciuXuYheW6lclav68iFwy+f//TdUaHATymDfDQJJ yKqPzr4+kqyNVWwXKGcY9cOVqQPKDYtpHEgzFqEMHBTfBRK+VcRcBwAB5Lr6A6E0wR6l wACleXKn0QYaN91mFuu/SVU7j1Uqk7j6u5q9Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=d9kZCln6GRDQn3nqqQpaHdbUBYky2JMtsbnOoWIz0N4=; b=B8C4nXOKS1MDB1csTZm5nijmIlrao7VbP9gOprfmDPMnUEI5qauq6X3/pxBGG0L1a1 7D6WgpD6RFrD3PM67xQqMBvUolqpX4IQTdLMpVtQpbQgUzk+3ZzqdBnnu/47IcNtCIxp wNavwo9mAEJVp/fN7M5gRpU2wRTQwwBaQokvdNFDAKId0DpheJE+2dp4qqPX1Th0xBmU TIe+3xa/zCLYJlVVJL/NIRO8JZu8HE7+Lip2q/tlgL2rbVWZQOejk+/9S21vL1kYu5o+ mz0FikrjaTyccGYldD352lAw8Mb6IIva7vydvfmkEIefPXHUiC9e+44m5mu4m0UfHjpv 2qhw== X-Gm-Message-State: AJaThX6Hr6MUIftZnBCFi1fpfYbDK5PE7KX+4DEuHTHgimK/v4lYiNUm qe+FFABl1LQD8sOGAV/bgEJzLA== X-Received: by 10.80.230.143 with SMTP id z15mr2253280edm.106.1511177588267; Mon, 20 Nov 2017 03:33:08 -0800 (PST) Received: from [192.168.1.24] (cpc87211-aztw31-2-0-cust196.18-1.cable.virginm.net. [82.46.60.197]) by smtp.gmail.com with ESMTPSA id z1sm8877398edz.17.2017.11.20.03.33.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 03:33:07 -0800 (PST) Subject: Re: [PATCH v2 1/4] backlight: as3711_bl: fix device-tree node lookup To: Johan Hovold , Lee Jones Cc: Jingoo Han , Bartlomiej Zolnierkiewicz , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable , Guennadi Liakhovetski References: <20171120104547.2639-1-johan@kernel.org> <20171120104547.2639-2-johan@kernel.org> From: Daniel Thompson Message-ID: <83a0c1bc-b303-70e9-606b-71161bcf3763@linaro.org> Date: Mon, 20 Nov 2017 11:33:04 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171120104547.2639-2-johan@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/11/17 10:45, Johan Hovold wrote: > 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. > > Fixes: 59eb2b5e57ea ("drivers/video/backlight/as3711_bl.c: add OF support") > Cc: stable # 3.10 > Cc: Guennadi Liakhovetski > Signed-off-by: Johan Hovold Acked-by: Daniel Thompson > --- > drivers/video/backlight/as3711_bl.c | 33 +++++++++++++++++++++++---------- > 1 file changed, 23 insertions(+), 10 deletions(-) > > diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c > index 734a9158946b..e55304d5cf07 100644 > --- a/drivers/video/backlight/as3711_bl.c > +++ b/drivers/video/backlight/as3711_bl.c > @@ -262,10 +262,10 @@ static int as3711_bl_register(struct platform_device *pdev, > static int as3711_backlight_parse_dt(struct device *dev) > { > struct as3711_bl_pdata *pdata = dev_get_platdata(dev); > - struct device_node *bl = > - of_find_node_by_name(dev->parent->of_node, "backlight"), *fb; > + struct device_node *bl, *fb; > int ret; > > + bl = of_get_child_by_name(dev->parent->of_node, "backlight"); > if (!bl) { > dev_dbg(dev, "backlight node not found\n"); > return -ENODEV; > @@ -279,7 +279,7 @@ static int as3711_backlight_parse_dt(struct device *dev) > if (pdata->su1_max_uA <= 0) > ret = -EINVAL; > if (ret < 0) > - return ret; > + goto err_put_bl; > } > > fb = of_parse_phandle(bl, "su2-dev", 0); > @@ -292,7 +292,7 @@ static int as3711_backlight_parse_dt(struct device *dev) > if (pdata->su2_max_uA <= 0) > ret = -EINVAL; > if (ret < 0) > - return ret; > + goto err_put_bl; > > if (of_find_property(bl, "su2-feedback-voltage", NULL)) { > pdata->su2_feedback = AS3711_SU2_VOLTAGE; > @@ -314,8 +314,10 @@ static int as3711_backlight_parse_dt(struct device *dev) > pdata->su2_feedback = AS3711_SU2_CURR_AUTO; > count++; > } > - if (count != 1) > - return -EINVAL; > + if (count != 1) { > + ret = -EINVAL; > + goto err_put_bl; > + } > > count = 0; > if (of_find_property(bl, "su2-fbprot-lx-sd4", NULL)) { > @@ -334,8 +336,10 @@ static int as3711_backlight_parse_dt(struct device *dev) > pdata->su2_fbprot = AS3711_SU2_GPIO4; > count++; > } > - if (count != 1) > - return -EINVAL; > + if (count != 1) { > + ret = -EINVAL; > + goto err_put_bl; > + } > > count = 0; > if (of_find_property(bl, "su2-auto-curr1", NULL)) { > @@ -355,11 +359,20 @@ static int as3711_backlight_parse_dt(struct device *dev) > * At least one su2-auto-curr* must be specified iff > * AS3711_SU2_CURR_AUTO is used > */ > - if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO)) > - return -EINVAL; > + if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO)) { > + ret = -EINVAL; > + goto err_put_bl; > + } > } > > + of_node_put(bl); > + > return 0; > + > +err_put_bl: > + of_node_put(bl); > + > + return ret; > } > > static int as3711_backlight_probe(struct platform_device *pdev) > From 1584581683847469415@xxx Mon Nov 20 10:47:34 +0000 2017 X-GM-THRID: 1584581683847469415 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread