Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp248256imm; Wed, 18 Jul 2018 01:13:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe0DC7KZHi55BYAd0CNdmQtjYxnZcKBXEuO3InHBveX8T2iEJhCtz73CyIelF87q4rC/xlU X-Received: by 2002:a63:c00b:: with SMTP id h11-v6mr4729420pgg.279.1531901627241; Wed, 18 Jul 2018 01:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531901627; cv=none; d=google.com; s=arc-20160816; b=XgJWpN6KFe2AzexcaO3ClZfAxmDXCqcZAX1iMIWrlmmGCqBfMa79LDLJor2PsueIQf K1tOpb6A+yumpO5YeIrYKsq4crazxmSTmQZnl5xZcd7fvcbK7z0gUEw1QV4FF6lgEc2w V6cMlZ4JhDSB/ONrJYTpmD+W7nOFzPOFe9m2kshcqc44TvhLFcHUKolTIwMJxbTT4P+T 1bUUa5t7kVwh+sOHqJA/nCsnIMRqA5bauzp5ZWNKpH6RrdL2Bovecsxr9r4llBlTexfS 3GbkzlFh+FMJGl5zqWGC0V5ITbjwe/KwPvCxJi/dx7+38oP3DS2zZd9AWY3ejyyazg8P HLww== 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=+DpQZJb4O8SMmBin3advwJj/mGc2r5CrsnYAYFNCHWs=; b=O7QJzwFPROKV3IN6b64pJF2JWODtH3jOIke5EdAELuLJDe94QMmhwt/BQHbmTdNeyz G0pZXu9KpR5g8cp9tDGJywVmqxHgCuNUbn+zcaLnVU3kttyl8NbruwGiRy4WZxN+izBp RPMX4XZfM6gPjKVf1PocIA9DQl1+LWg8aBDDyAjHVW3wotJMeU796aZ9eQqZ48XPHU+i pG4NNs8MKvEalqlhYKCi+RzxGOByiiylgZDx6o7T7OrS2gM0yAQ5JP7ZYEQ7RJasHw1T qt4XDFv4LaMe1BeFa7obX/gRz0ktGFbnKCldcQ+Cb0bX+evCo5YyjJP1OkcwdvT1rtl0 wiqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pc9zKycN; 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 k72-v6si3027060pgc.304.2018.07.18.01.13.32; Wed, 18 Jul 2018 01:13:47 -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=Pc9zKycN; 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 S1728554AbeGRIti (ORCPT + 99 others); Wed, 18 Jul 2018 04:49:38 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53695 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbeGRIti (ORCPT ); Wed, 18 Jul 2018 04:49:38 -0400 Received: by mail-wm0-f67.google.com with SMTP id s9-v6so1828970wmh.3 for ; Wed, 18 Jul 2018 01:12:55 -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=+DpQZJb4O8SMmBin3advwJj/mGc2r5CrsnYAYFNCHWs=; b=Pc9zKycNkXoWfUghWb/EdsFFKpb/qP7MUP1t2jRVA456kpYJs/WQkBJ7O/XQb28tQ4 KLi9KQpULwUQC7WJZIe/xTfDyhN184mqyLUSDvvHxBciBoGFbOjBpg7aLc+Wobh14V/R Z6xyQlfdPERZvG45bJDWg/ks8pPWCLDTimcpY= 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=+DpQZJb4O8SMmBin3advwJj/mGc2r5CrsnYAYFNCHWs=; b=EF1Y4RqbvqaTibB6srs0m8GgdIllQ6G2uvBQ7/blGWgnYHeKN30TLaGlKjhVwH/6WS hKftSkcET4Bs8GoJW/oVq5P6wDGRXLHwhTpyxlXJOIpw+D18Q1qUXRjZjJpldBQNN+cq +YxslsRASxhIHY7QDfgDOXXNs3VyM95vHOxsloGp4scHfP0n1MLBEkj6hGO/0K9Uiyph pcFdqO/fODkQ5++O5cCSSz1yqQXp8FW/8bPgjnV6LMjDQ0I+q1s3sqEOFQce//CkNbwi /13syv1XVC+xhe/DdjD8DKC16vKqlO4ldRfdCtY+afPxMx45i3FZXprEAN1C9PMiQAUN EE8w== X-Gm-Message-State: AOUpUlHkXRSfgG4tRxzu0hyec2vTP0CB+hty/8j7fsvpEbrTniiQcbKc S6liqJLqqE+sWFIxbFVdMc2txQ== X-Received: by 2002:a1c:f703:: with SMTP id v3-v6mr881800wmh.48.1531901574965; Wed, 18 Jul 2018 01:12:54 -0700 (PDT) Received: from dell ([2.27.167.87]) by smtp.gmail.com with ESMTPSA id t70-v6sm2273074wme.7.2018.07.18.01.12.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jul 2018 01:12:54 -0700 (PDT) Date: Wed, 18 Jul 2018 09:12:52 +0100 From: Lee Jones To: Daniel Thompson Cc: Jingoo Han , Thierry Reding , Bartlomiej Zolnierkiewicz , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, patches@linaro.org, Marcel Ziswiler Subject: Re: [PATCH] backlight: pwm_bl: Fix uninitialized variable Message-ID: <20180718081252.GC4641@dell> References: <20180716210241.9457-1-daniel.thompson@linaro.org> <20180718080913.GB4641@dell> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180718080913.GB4641@dell> 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, 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? > > 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? > > > 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); > if (!ret && num_steps) { Whoops! I was playing around with the 80-char limit and forgot to revert. The lines should read: 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. > > > + /* > > + * Make sure that there is at least two entries in the > > s/is/are/ > > > + * brightness-levels table, otherwise we can't > > + * interpolate > > Why break the line here? > > > + * between two points. > > + */ > > if (data->max_brightness < 2) { > > dev_err(dev, "can't interpolate\n"); > > return -EINVAL; > -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog