From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Jones Date: Wed, 25 Jul 2018 05:22:11 +0000 Subject: Re: [PATCH v3] backlight: pwm_bl: Fix uninitialized variable Message-Id: <20180725052211.GA5835@dell> List-Id: References: <20180716210241.9457-1-daniel.thompson@linaro.org> <20180724071223.18901-1-daniel.thompson@linaro.org> In-Reply-To: <20180724071223.18901-1-daniel.thompson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: Daniel Thompson Cc: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Bartlomiej Zolnierkiewicz , Marcel Ziswiler , Jingoo Han , patches@linaro.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Thierry Reding On Tue, 24 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 with a simple initialize to zero. > > Fixes: 573fe6d1c25c ("backlight: pwm_bl: Linear interpolation between > brightness-levels") > Reported-by: Marcel Ziswiler > Signed-off-by: Daniel Thompson > Tested-by: Marcel Ziswiler > --- > > Notes: > v3: > - Switch to the simplest fix and zero the uninitialized variable. git > grep indicates that ~25% of calls to of_property_read_u32() use this > pattern (pre-initialize optional properties with sane values and > ignore the return code). > > v2: > - Simplify SoB chain (with Marcel's permission) > - Separate complex if statement and make other similar calls use same > return code checking approach > - Tidy up comment formatting and fix pre-existing grammar error > > drivers/video/backlight/pwm_bl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Once the 'Fixes:' line has been repaired: Acked-by: Lee Jones -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Jones Subject: Re: [PATCH v3] backlight: pwm_bl: Fix uninitialized variable Date: Wed, 25 Jul 2018 06:22:11 +0100 Message-ID: <20180725052211.GA5835@dell> References: <20180716210241.9457-1-daniel.thompson@linaro.org> <20180724071223.18901-1-daniel.thompson@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: Content-Disposition: inline In-Reply-To: <20180724071223.18901-1-daniel.thompson@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Daniel Thompson Cc: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Bartlomiej Zolnierkiewicz , Marcel Ziswiler , Jingoo Han , patches@linaro.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Thierry Reding List-Id: linux-pwm@vger.kernel.org T24gVHVlLCAyNCBKdWwgMjAxOCwgRGFuaWVsIFRob21wc29uIHdyb3RlOgoKPiBDdXJyZW50bHks IGlmIHRoZSBEVCBkb2VzIG5vdCBkZWZpbmUgbnVtLWludGVycG9sYXRlZC1zdGVwcyB0aGVuCj4g bnVtX3N0ZXBzIGlzIHVuZGVmaW5lZCBhbmQgdGhlIGludGVycG9sYXRpb24gY29kZSB3aWxsIGRl cGxveSByYW5kb21seS4KPiBGaXggd2l0aCBhIHNpbXBsZSBpbml0aWFsaXplIHRvIHplcm8uCj4g Cj4gRml4ZXM6IDU3M2ZlNmQxYzI1YyAoImJhY2tsaWdodDogcHdtX2JsOiBMaW5lYXIgaW50ZXJw b2xhdGlvbiBiZXR3ZWVuCj4gYnJpZ2h0bmVzcy1sZXZlbHMiKQo+IFJlcG9ydGVkLWJ5OiBNYXJj ZWwgWmlzd2lsZXIgPG1hcmNlbC56aXN3aWxlckB0b3JhZGV4LmNvbT4KPiBTaWduZWQtb2ZmLWJ5 OiBEYW5pZWwgVGhvbXBzb24gPGRhbmllbC50aG9tcHNvbkBsaW5hcm8ub3JnPgo+IFRlc3RlZC1i eTogTWFyY2VsIFppc3dpbGVyIDxtYXJjZWwuemlzd2lsZXJAdG9yYWRleC5jb20+Cj4gLS0tCj4g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IE9wZW4gc291cmNlIHNvZnR3YXJlIGZvciBBUk0gU29DcwpGb2xsb3cgTGluYXJvOiBGYWNlYm9v ayB8IFR3aXR0ZXIgfCBCbG9nCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fCmRyaS1kZXZlbCBtYWlsaW5nIGxpc3QKZHJpLWRldmVsQGxpc3RzLmZyZWVkZXNr dG9wLm9yZwpodHRwczovL2xpc3RzLmZyZWVkZXNrdG9wLm9yZy9tYWlsbWFuL2xpc3RpbmZvL2Ry aS1kZXZlbAo= From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D7F3C6778F for ; Wed, 25 Jul 2018 05:22:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABA3020844 for ; Wed, 25 Jul 2018 05:22:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linaro.org header.i=@linaro.org header.b="LK5Buoeq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABA3020844 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbeGYGcN (ORCPT ); Wed, 25 Jul 2018 02:32:13 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55866 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727460AbeGYGcN (ORCPT ); Wed, 25 Jul 2018 02:32:13 -0400 Received: by mail-wm0-f65.google.com with SMTP id f21-v6so4636153wmc.5 for ; Tue, 24 Jul 2018 22:22:14 -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=xmBehj3++Bf8c4xWsg0sQCIbto8gy5/8bznLBjD7bGA=; b=LK5Buoeq8MfNoN1zA1HDDClT4syg0kntB7Z0ip9xU1/XT6cBMof8KClc4tKWDa25v0 kTZnh4Hy8P6luCKuaphAVZ876J+7go3gYCy1py9IiMZkVZnI5Blg7ErbUxx3DYrhbUCE Bcfwq4wpdMR85wAO9cfg4TUH5D8xPKfJ7vqpw= 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=xmBehj3++Bf8c4xWsg0sQCIbto8gy5/8bznLBjD7bGA=; b=F3W/tr17/aW6ZZncoj2lRMvdGoE34Pp5q700DfKMf2qt86xik3dUOgjLU89KRMj+rJ 4Nn9DkiGCFQT8rv2fMhvlh9Et3KIv5T6Ru7jZvbfjX7lqQYDywWgK5ouSw25aXIDSF+T kUN7tKM3VWiEChEjbc+0Fy1OhJph+ummrz6O/xbQAImfD7oeBYEdJMP6YFybaqoml565 H2pgn6CdfOObxKz48teAoabRIs1C9TFp+rfXx8eqrHru7JouJigEgHM3lJF61WftGboI 8r14b/OMaRmDmQXY0WIkA/zEatWYmx/Gf9sXQ+1QG2RO0eqzVDLyBYvhQ7FBFffIAdmn JCYg== X-Gm-Message-State: AOUpUlElmSWCcI1ByMuQGYHk781QxjjxGHY/cR3pJdb6cOCKcXjdjlXN qVuLxGaepST5p2CVLotcExyL/Q== X-Google-Smtp-Source: AAOMgpeJ/o/H0/j7s1ZQL4xJEkXoiFfKOpXHAvYfcGfPFH+QMLgI3kmTh4AXVPvG/OByaIu2yYS5kw== X-Received: by 2002:a1c:7d47:: with SMTP id y68-v6mr3402088wmc.62.1532496133806; Tue, 24 Jul 2018 22:22:13 -0700 (PDT) Received: from dell ([95.149.164.105]) by smtp.gmail.com with ESMTPSA id t186-v6sm825443wmf.14.2018.07.24.22.22.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Jul 2018 22:22:12 -0700 (PDT) Date: Wed, 25 Jul 2018 06:22:11 +0100 From: Lee Jones To: Daniel Thompson Cc: Jingoo Han , Thierry Reding , Bartlomiej Zolnierkiewicz , Marcel Ziswiler , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: Re: [PATCH v3] backlight: pwm_bl: Fix uninitialized variable Message-ID: <20180725052211.GA5835@dell> References: <20180716210241.9457-1-daniel.thompson@linaro.org> <20180724071223.18901-1-daniel.thompson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180724071223.18901-1-daniel.thompson@linaro.org> 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 Tue, 24 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 with a simple initialize to zero. > > Fixes: 573fe6d1c25c ("backlight: pwm_bl: Linear interpolation between > brightness-levels") > Reported-by: Marcel Ziswiler > Signed-off-by: Daniel Thompson > Tested-by: Marcel Ziswiler > --- > > Notes: > v3: > - Switch to the simplest fix and zero the uninitialized variable. git > grep indicates that ~25% of calls to of_property_read_u32() use this > pattern (pre-initialize optional properties with sane values and > ignore the return code). > > v2: > - Simplify SoB chain (with Marcel's permission) > - Separate complex if statement and make other similar calls use same > return code checking approach > - Tidy up comment formatting and fix pre-existing grammar error > > drivers/video/backlight/pwm_bl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Once the 'Fixes:' line has been repaired: Acked-by: Lee Jones -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog