Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp510905imm; Wed, 18 Jul 2018 06:11:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpes3ykuWAGHfieVCL9Yg8bDsqhPoGCHkd5btqdOly7UvRzAuou/8CaSdv1vrWhwQCzJGlmo X-Received: by 2002:a63:2013:: with SMTP id g19-v6mr5731751pgg.68.1531919471925; Wed, 18 Jul 2018 06:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531919471; cv=none; d=google.com; s=arc-20160816; b=JBYKuvNHtKNp5nLIEz1KBIWIgt2vPK2GTspbixm1kjcMGvxxwugIn3UO6yRdCCSSeh s9pmIJxmoze52muXl6D+X9eEyKfDXayx97k5BnLAlgTn7vXmbcu0zUrqEQg3dBdWwYqX sz9gAlnWIZOpJBZ4CPpKbRvI32dEVHb9JlnTF/IaP/uPX07I5f338QDyX0ql9bNeHQKg o9bNKn741KTDLLSqSUcSI0SfYDIl+s+eJG7iPdTM9Y6ZQ4cwfPf5gGuDC1lUxNadRGk6 O8o1C9Sd6R5Lxf3HBpWaEXPkZHkFAAGQyo9/0ZupQKO1gZzJLQZpkZ7GzY3DDDh6V0pI +gzg== 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=Tu8dnYToKlaGD8qb90x7+4en6DCRfXkyV08VUJYO+RM=; b=heyMGTBzaB10v5v+Yhk2hzZHdNL2sydq6t11bkcovYJeFGKpOIq/+U7SkbnS3Ef5Yh RCqif0zykm8LccImBfTRrgU9JQDERtYnws2OUcv1WQa1gBLfrBEfhecfcs038K5VKGcr sGnXpjc6VfXIs5VT4gHwC4e2g9olPZzV9+ygRXTv7rq+AQZ7oJHPph2CPktpr6XWLj1A tv/lLAg/cUjt1dxgGcX+4m2VSlBMwxyXAE2HJbs2Z785B64toi0MI6ux953aFQINlXv4 Yj5Rcn7aSk5cL8Zk7MCzOzkhucPFbKRZXBfK+fpQmAfbcL8lCP+lQ4pr2gTixzlzKatl sOvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+Q3dorB; 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 m13-v6si2985223pls.70.2018.07.18.06.10.56; Wed, 18 Jul 2018 06:11:11 -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=P+Q3dorB; 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 S1731031AbeGRNqu (ORCPT + 99 others); Wed, 18 Jul 2018 09:46:50 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45907 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729325AbeGRNqu (ORCPT ); Wed, 18 Jul 2018 09:46:50 -0400 Received: by mail-wr1-f65.google.com with SMTP id c4-v6so4612719wrs.12 for ; Wed, 18 Jul 2018 06:08:57 -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=Tu8dnYToKlaGD8qb90x7+4en6DCRfXkyV08VUJYO+RM=; b=P+Q3dorBOgFCDBGQ+OfjQdTLV16PcXKTLOc4MJwuxSiPVX2dubLH9fY+6t8Mhu/jqU EoW/jfiO3l6610ameaRl7QPqfToQHg67LY6M1FKngApu9RpgflcwIKg3II6RxrkYBrLX IYKWZ8TBijCTF9bg4hT6Ufx1q0MaiTN6Pcp+c= 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=Tu8dnYToKlaGD8qb90x7+4en6DCRfXkyV08VUJYO+RM=; b=MiWEVaBh070lgJMeI/64DO8ITXGCo+Xs5sN6zePlH5Ne1Acf5h9ePxrsujQeuw09Cf HxFklO42YgH/IyLXcf4jEAjo+IDWRurfMkrUKtfGoGFa3YtE/FuEcClZOAEMoeV4N+eW Dro9JqkEZAH6EM6J74C7DxrM4ZfxLTHndxIzoK+PWHTL+YtwjTTjyAAwuLmq7g64nQfW wKNshhABoBq7LeXTwgYclIooJD3mMqSCYmR0US2Ead/OIBobCv+MwsNf0KNpSRNaMSO0 jvn7pdROpeTelNWhPCfIGaf/vaCbJo8OWjEBtjnrvkpxxR1bLLDFkjKPZBDdIQ+rbnSq Wt3w== X-Gm-Message-State: AOUpUlHkA3MDBhg1MYluP9fwvF9E5teAYZqNn4eS8TgOdneIDkpX/zll AaHP6SUg2qY7ZtKpbBiyivV/cg== X-Received: by 2002:adf:e50f:: with SMTP id j15-v6mr4515934wrm.111.1531919336903; Wed, 18 Jul 2018 06:08:56 -0700 (PDT) Received: from dell ([2.27.167.87]) by smtp.gmail.com with ESMTPSA id u135-v6sm3379964wmf.2.2018.07.18.06.08.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jul 2018 06:08:55 -0700 (PDT) Date: Wed, 18 Jul 2018 14:08:53 +0100 From: Lee Jones To: Marcel Ziswiler Cc: "daniel.thompson@linaro.org" , "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: <20180718130853.GE4641@dell> References: <20180716210241.9457-1-daniel.thompson@linaro.org> <20180718080913.GB4641@dell> <1531902119.16896.13.camel@toradex.com> <20180718095335.GD4641@dell> <20180718101227.shqf54wpt4kdrsj2@holly.lan> <1531918626.16896.22.camel@toradex.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1531918626.16896.22.camel@toradex.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Jul 2018, Marcel Ziswiler wrote: > On Wed, 2018-07-18 at 11:12 +0100, Daniel Thompson wrote: > > 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 ;-) ]. > > Yes, I take all the blame for the extra brackets. Regardless of having > a masters in CS or not I still prefer too many then too few of them (;- > p). > > > > > > 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. > > Yes, I guess it definitely does not hurt. > > > > Then it will only be set if of_property_read_u32() succeeds. > > Yes, but we still need to check for both, the function not failing and > num_steps to actually be non zero. Why? You don't do anything differently if it fails. -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog