Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp327880imm; Wed, 18 Jul 2018 02:54:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpexXZQf6RdN0V7HlzlUh1p/Wck8xfiT0ck15s7K0CNw4HW49CX/M2F+EWEcnnh8/5zChf6k X-Received: by 2002:a63:67c3:: with SMTP id b186-v6mr5198131pgc.5.1531907672279; Wed, 18 Jul 2018 02:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531907672; cv=none; d=google.com; s=arc-20160816; b=ipRmYotlnEQG8aSuEbQHRgk7oYreJ08UemZ3SiHcbLYlZvAl4wb4bTH5aYc3EJRQgq X7tlHRNzjqlemDV9xBk8cEFH4vfwkG35uHovMvYZV2BUhzWv0qAjkcGGwoKEnUxgRgYe qeXgrp65XM3a6THKvLVxQdjOo6Qqg++vKMsoCFTV8CFi6G/6ncpgXzJ7DBbX0XNR4TVB XOjVm+zP+hLa+B5GfwiSjmX6RWVeDG2w3l7nVFHlIgN9H62wHeYYhxe+uRHJOzBBCID2 tbWiw9aovQbWjL53P720aUmOSt7QxL0P0D7+XOFWduZeJDjNZFrLqacWOlG6hvxxAxMU 4Uwg== 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=Uyel6n6uZNKwB9mKaSwJWpWIMG9GDlPkMBde/FhE8nM=; b=WVd9SjjWHKjVI6A2o8muJi8ER+olSKHuY9kFgUHaZ/0HiSeLag7Q37x/syGtbwvJZM fyY1wgpA/JP2F+we+FNHTZinVtZUTvEZBRgDb9mCqU91M3t0FhacxsmUAxSvByoCy7eg Tq9w+O83/pAzFT03ZmyJYTqOPdfBuozwJ+7eSC2ImCsK5Ps6m9q3rpOVlGKF0gNZDmLa 74IEovYqFLANDh6Q/Er3nxAy0bGasg9MmmqxWzXjbTxLPwhWu6tvqFSzUHntzbjXxiNf 66+/NTNNBQ6q9vOWDClfpbF164eOTtymZwzDpDH1wwFU8Bo1qA9GWoPOR2hofzEoX82z yehg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YJslvL3x; 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 w19-v6si2744355plq.236.2018.07.18.02.54.16; Wed, 18 Jul 2018 02:54:32 -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=YJslvL3x; 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 S1731068AbeGRKaq (ORCPT + 99 others); Wed, 18 Jul 2018 06:30:46 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:39810 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729619AbeGRKaq (ORCPT ); Wed, 18 Jul 2018 06:30:46 -0400 Received: by mail-wm0-f68.google.com with SMTP id h20-v6so2174553wmb.4 for ; Wed, 18 Jul 2018 02:53:39 -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=Uyel6n6uZNKwB9mKaSwJWpWIMG9GDlPkMBde/FhE8nM=; b=YJslvL3x/LCCRzWCV/vDnNLNLg7xlOL4gj9rxHnns9qBkAjDnZKRPJm1pfXe0rT+vN 4W5Gga7OKsc7Liyafo6Jg0Rbg1AJWROed0KgsyxpiW8f4WvCPE0uJdnBadPoqcw0R2B7 EMhrtv4/88mqGBOeBkz8SelNu8plEwdtqQqXw= 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=Uyel6n6uZNKwB9mKaSwJWpWIMG9GDlPkMBde/FhE8nM=; b=ua12e/B4mum+o/xnwuRwiXZUGm76sof21UfbEhHMEXKN9Vm0YKne4jVkX2LMbwduuY 52dMGvd3r65QhYEfh0YuhrIC8XhlHIz3BNCwVu4Hw3PZBRIFu8nWX9YF0VGACkvLSGHV 4QsEwbY1CcksFOExV9p2vYlpPs03V1LR5NZCwnCsVEfQM3jwnYN7AGdtdVqCZsT5jty+ Qp4j503chz9aXc5UOQhsFgA9qJns8TlxNLmUkhBorI/JRdx4/efZQK0bXMdyo+FrImfT B+xgS3o723XuUpLFXaH2J1i/riit4JOj+7ZUCFjORCE9TtEbzE2ApGFngurWs3jvSI/F qiWA== X-Gm-Message-State: AOUpUlHh5pBW7VwQlPRaRYOGrJKgwXs4Qw0dNVZfIARUTQCKv0g6J7T3 /tvL+8j3AN0BTFagjUhnAVvEuA== X-Received: by 2002:a1c:910f:: with SMTP id t15-v6mr1213865wmd.51.1531907618924; Wed, 18 Jul 2018 02:53:38 -0700 (PDT) Received: from dell ([2.27.167.87]) by smtp.gmail.com with ESMTPSA id z7-v6sm1814511wma.2.2018.07.18.02.53.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jul 2018 02:53:37 -0700 (PDT) Date: Wed, 18 Jul 2018 10:53:35 +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: <20180718095335.GD4641@dell> References: <20180716210241.9457-1-daniel.thompson@linaro.org> <20180718080913.GB4641@dell> <1531902119.16896.13.camel@toradex.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1531902119.16896.13.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 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. > > 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