Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp259668imm; Wed, 18 Jul 2018 01:28:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpchfabd5k9Doa/g4hj/hCH6KUJntTa/bDCveNZcxdhTiEKe6hqvCqVzWq28tg9nfRUwCiK4 X-Received: by 2002:a63:4b1f:: with SMTP id y31-v6mr4972694pga.14.1531902508680; Wed, 18 Jul 2018 01:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531902508; cv=none; d=google.com; s=arc-20160816; b=AYzH0Ys8G0zBhScY4LadntVjZU3i8fmeeeozgofT0lRACZIxz4gGqG2rl2JF9hrR3T 52NSaJtoTCKRV1FYVNXHKfA+xaptl3XWZnlh6DKEseg2/6HfVN9oxvPfMpdkLDwMjzDv c1Jk6auFuc1/ew+qmTUleBoxoijn2lFcTdkkg6M/5KFprxxIprZV9nFjPA2hnKTbDAjF 0OOu3jEG82a99yOtYE71A6bzr2n2sng515fn3ZK8Fsmm8KbZAJPKU6ATbx5SHBkQIxF+ fjN6/8TsIass4zxCbXjHQBcGeDaNS8bwGecRfYUbTCZcgvW4W8WwMVzi40r5fmuPzKxY M6Sw== 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=m+SsIjLlRyDeR+kc2Wtn+ND/o6S0cPhCdjfLuzrh+T4=; b=Gl0nnrnyvIYkidYQ6d7iDSutP1Ke016vENoZGpkspmGoXg24qsjiOwV2AmUmkLtDFL M9n0ioQAZ2DBHSEbTjsGjYRlM2rFzd/8v1Kvaw3K86nSH+DaGQqFPv4XhE/XZsmLOXag OAIZqeY3ClKa+hBH2HJhEjLIZguLacszISnFAQEXPq3HGkFuQe3COhq4dyOYEmmJ+Lnd oPXABhUSkKvVa6lp3yKKgAGCJX2kI+1EqEkQLShNkK4z4UVVgn3fO18MPuXumd6wkrmp 4q/NWwfnKvpSBHQ8FkhxfC2kyaUs1KUjAkY+O5PijucrEcvFMnZ/4YFtrSXKO98jm8xp Qk2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bJlMZpNE; 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 t10-v6si2821568pfk.228.2018.07.18.01.28.13; Wed, 18 Jul 2018 01:28:28 -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=bJlMZpNE; 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 S1730512AbeGRJDM (ORCPT + 99 others); Wed, 18 Jul 2018 05:03:12 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38175 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726240AbeGRJDM (ORCPT ); Wed, 18 Jul 2018 05:03:12 -0400 Received: by mail-wm0-f67.google.com with SMTP id 69-v6so1897937wmf.3 for ; Wed, 18 Jul 2018 01:26:26 -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=m+SsIjLlRyDeR+kc2Wtn+ND/o6S0cPhCdjfLuzrh+T4=; b=bJlMZpNEUoiIslqcpGD6h/y7oxGNTTZbTFrc77z19prZPCr5J2q5iAksdjYP+Ry3R6 Sal0+HAHs32aHAszBEtrGPRfo6aC1OYRrWYoeNwOGB6M0eHbLM5Wtahnci5SorSRAX4L NMH0VvezQYIPSHeU1MylGL1La1H0zUSe0ZmfA= 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=m+SsIjLlRyDeR+kc2Wtn+ND/o6S0cPhCdjfLuzrh+T4=; b=JF8SZLP/zA7y5YNzULnXVcRI1V+R9DRvFZ9NiJAq4GP7Q3PEvAOAVyk30jlOr5scOw UHbsHIbWo1uVe1LXKbMKGHD0e2BTm4uNH3284prscdZnKuHy9h5pwhlIgEQt2w3BjC4E bC0BdLNVAdoZ3Nb0hq6ujaWtRmkHelGcC4FeuSN7SRddYQJFpxf4JEfCc6yUzRofjnwX hm6LY4WnS/ZgZYMSrAIcsUR1P3ZzU+7hYeUzOkQaEkP2eqoIXlPDZfFNUB547vaR/Nbo QlzormUm9YoQj1papZmFkE28Lz9W2lwAQSTQf962+X8glmmhie9EbqA1uq0rTHyepaXR SJfQ== X-Gm-Message-State: AOUpUlFlDhREsmSQbt2hJpZYqNUi0Ocfa0hxwD/4CmDYWtCMGeAxk3Ga miviUW+nEe3FFxYvrjbhUhCNRA== X-Received: by 2002:a1c:1d2:: with SMTP id 201-v6mr894175wmb.4.1531902385971; Wed, 18 Jul 2018 01:26:25 -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 h8-v6sm1268527wmb.32.2018.07.18.01.26.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jul 2018 01:26:25 -0700 (PDT) Date: Wed, 18 Jul 2018 09:26:23 +0100 From: Daniel Thompson To: Lee Jones 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: <20180718082623.nycf2vhlt6yj4bxp@holly.lan> 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: 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 09:09:13AM +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 (although the manipulations were fairly mechanical). > > 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) { > > 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