Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp345673imm; Wed, 18 Jul 2018 03:13:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdvejyQgU1hCYv9YWDfObqDdGevj6CgCQvzArXQbQJooM3AEkqu5kJ0VA6KeXxZBqf0HyBf X-Received: by 2002:a63:8341:: with SMTP id h62-v6mr5029647pge.298.1531908802096; Wed, 18 Jul 2018 03:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531908802; cv=none; d=google.com; s=arc-20160816; b=scaS7GQiRTS2gGIQSR9VWwFECiyeM+SrCF+jWzNg2jD02s5lPna6LnYxQh07906T7n PpsKolD6vgAvrQK+/Ok7FeZIkR1QlAYPMpBEmMylfHwxIgsNvMxcZuKKKEI7Z+YqK2g8 UUq1UHddysmCS2bq2LuU+JAbkaAEhtyVENFLnsYqIL7CQRcZTy/iNzPLA8ShkIkiLSir CNwk1eikq4bjsyxQW9SgaBSKMy0LMtm7o6gcAXl/tUWMjWbhNUi5K0e4nJXGAqqQ/G8H mUVAIFMvqCqUiCwr0+NC3Vi29ZKAJGM9O+4QkOyXg235oSDGS7M7MGSqL3geVWdYw1Pe beoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=imUCsgRDqHoDd4+CkueS+QavmBqEWNumZNHqCcUy4ow=; b=i5czxE3tAwXo3kjMS8cMQmjUS/XgJfTs9m5V/sw9BHE8uE7XD5M18uLwelvxvqSGIs wCgu/MosDErK7rJve5COUm1qVJjWnTcMZTuMgEb4q0zBWFE1ow5HB/C4YABl3pvPF6e2 79jCoVgP15KuDRUbN8cpukd6rdvshiXvSSZ+jadnI9dVScYW4m8b8512ofMYNHOfwFX9 t6T/qNzq9DXYWsqR6oF0cJEP/O6w9f/PX2sC63kiThAzNY+taeq7FV5GMwfUo3crNIX7 3pJfp1epyaufhGqbp15IxM1CnKJikaGMIzHW3d+eIP02us5Py29SQW2WR6dxbh24cv+b vv+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IEPSyd9y; 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 b2-v6si2813531pff.192.2018.07.18.03.13.06; Wed, 18 Jul 2018 03:13:22 -0700 (PDT) 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=IEPSyd9y; 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 S1726901AbeGRKtl (ORCPT + 99 others); Wed, 18 Jul 2018 06:49:41 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38387 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726142AbeGRKtl (ORCPT ); Wed, 18 Jul 2018 06:49:41 -0400 Received: by mail-wm0-f65.google.com with SMTP id 69-v6so2243993wmf.3 for ; Wed, 18 Jul 2018 03:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=imUCsgRDqHoDd4+CkueS+QavmBqEWNumZNHqCcUy4ow=; b=IEPSyd9yX7grDssxetECIbydKk/egxkabtNzxGHryfIz3e5qu2Top+1LpzEL5SwSLG 4R1GuD7LNQo4XQZ4g+oDeU1otYAWV8lqP7o291Wf6pZsIXYN1MfZCdkZtMgAYd4Y/htD OSj+r2gwMFx/AWpfYKYTzSd70eMrYZigU9yjI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=imUCsgRDqHoDd4+CkueS+QavmBqEWNumZNHqCcUy4ow=; b=U4FUNK+ZzC1rs1v9azJ1LMYYzVDAJo/aI5UbcqxuzbR9hbn6jZEDT4kk2gjGDrFVAi MiqBWD+AHXZ0nQy7yEdQtvwD+dfA4dbx/YdOof4XFQvIMyrWAJlDEUR5lwL88qJ+Lr0f 29FUhAhIVRutv32yMSpsHc0BYpNTY0LulDVVEW6lF3SJqCRgC7zy/S432Ij2k/mGKbuR Z83+N93vEqCxzxfg3RVSzYBUV4jsjMRAX+lRUb7K1bfxhJ8kur/57TIjurJstQGWT4xl TNFC85OMIgzKLxXwGJGyto6nyUI/Iy9pVTZMpK6jm+GdlWdkO2ZGS5lv6LUDzkn/ueF5 6yVQ== X-Gm-Message-State: AOUpUlF8lpd0GG3cWt0zLH9FTTdg+7IaWbKlpInoNYFff+kDEewZq1QR gDISBBXnYZi1qJwIInSGmb9vaQ== X-Received: by 2002:a1c:9a16:: with SMTP id c22-v6mr1252816wme.114.1531908749982; Wed, 18 Jul 2018 03:12:29 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id f23-v6sm1450600wmc.42.2018.07.18.03.12.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jul 2018 03:12:29 -0700 (PDT) Date: Wed, 18 Jul 2018 11:12:27 +0100 From: Daniel Thompson To: Lee Jones Cc: Marcel Ziswiler , "linux-kernel@vger.kernel.org" , "jingoohan1@gmail.com" , "linux-pwm@vger.kernel.org" , "linux-fbdev@vger.kernel.org" , "b.zolnierkie@samsung.com" , "thierry.reding@gmail.com" , "dri-devel@lists.freedesktop.org" , "patches@linaro.org" Subject: Re: [PATCH] backlight: pwm_bl: Fix uninitialized variable Message-ID: <20180718101227.shqf54wpt4kdrsj2@holly.lan> References: <20180716210241.9457-1-daniel.thompson@linaro.org> <20180718080913.GB4641@dell> <1531902119.16896.13.camel@toradex.com> <20180718095335.GD4641@dell> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180718095335.GD4641@dell> User-Agent: NeoMutt/20180622 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 10:53:35AM +0100, Lee Jones wrote: > On Wed, 18 Jul 2018, Marcel Ziswiler wrote: > > > On Wed, 2018-07-18 at 09:09 +0100, Lee Jones wrote: > > > On Mon, 16 Jul 2018, Daniel Thompson wrote: > > > > > > > Currently, if the DT does not define num-interpolated-steps then > > > > num_steps is undefined and the interpolation code will deploy > > > > randomly. > > > > Fix this. > > > > > > > > Fixes: 573fe6d1c25c ("backlight: pwm_bl: Linear interpolation > > > > between > > > > brightness-levels") > > > > Reported-by: Marcel Ziswiler > > > > Signed-off-by: Daniel Thompson > > > > Signed-off-by: Marcel Ziswiler > > > > > > This line is confusing. Did you guys author this patch together? > > > > Yes, I reported it and we came to a conclusion together. > > It sounds like you need to have all of the tags (except this one). :) > > Reported-by: for reporting the issue > Suggested-by: for suggesting a resolution > Acked-by: for reviewing it > Tested-by: for testing it > > Signed-off-by usually means you either wrote a significant amount of > the diffstat or you were part of the submission path. He did [I don't object to but wouldn't have used the extra brackets you brought up ;-) ]. > > > > My guess is that this line should be dropped and the RB and TB tags > > > should remain? If it was reviewed too, perhaps an AB too? > > > > I'm OK either way and do not need any explicit authorship to be > > expressed for me. > > In this instance I suggest keeping Reported-by and Tested-by. > > > > > Tested-by: Marcel Ziswiler > > > > --- > > > > drivers/video/backlight/pwm_bl.c | 17 ++++++++--------- > > > > 1 file changed, 8 insertions(+), 9 deletions(-) > > > > > > > > diff --git a/drivers/video/backlight/pwm_bl.c > > > > b/drivers/video/backlight/pwm_bl.c > > > > index 9ee4c1b735b2..e3c22b79fbcd 100644 > > > > --- a/drivers/video/backlight/pwm_bl.c > > > > +++ b/drivers/video/backlight/pwm_bl.c > > > > @@ -299,15 +299,14 @@ static int pwm_backlight_parse_dt(struct > > > > device *dev, > > > > * interpolation between each of the values of > > > > brightness levels > > > > * and creates a new pre-computed table. > > > > */ > > > > - of_property_read_u32(node, "num-interpolated- > > > > steps", > > > > - &num_steps); > > > > - > > > > - /* > > > > - * Make sure that there is at least two entries in > > > > the > > > > - * brightness-levels table, otherwise we can't > > > > interpolate > > > > - * between two points. > > > > - */ > > > > - if (num_steps) { > > > > + if ((of_property_read_u32(node, "num-interpolated- > > > > steps", > > > > + &num_steps) == 0) && > > > > num_steps) { > > > > > > This is pretty ugly, and isn't it suffering from over-bracketing? My > > > suggestion would be to break out the invocation of > > > of_property_read_u32() from the if and test only the result. > > > > > > of_property_read_u32(node, "num-interpolated-steps", > > > &num_steps); > > > > you mean: > > > > ret = of_property_read_u32(node, "num-interpolated- > > steps", &num_steps); > > > > > if (!ret && num_steps) { > > > > > > I haven't checked the underling code, but is it even feasible for > > > of_property_read_u32() to not succeed AND for num_steps to be set? > > > > > > If not, the check for !ret if superfluous and you can drop it. > > > > No, then we are back to the initial issue of num_steps potentially not > > being initialised. We really want both of_property_read_u32() to > > succeed AND num_steps to actually be set. > > I also think num_steps should be pre-initialised. > > Then it will only be set if of_property_read_u32() succeeds. > > -- > Lee Jones [李琼斯] > Linaro Services Technical Lead > Linaro.org │ Open source software for ARM SoCs > Follow Linaro: Facebook | Twitter | Blog