Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp500573imm; Wed, 25 Jul 2018 00:40:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe3aP+kHwFX7vQqyxIOKCG4JFIxWIHeT4viEZu8vHHnMf4e6riyeoofwcEEiboLetXFqOyu X-Received: by 2002:a63:3190:: with SMTP id x138-v6mr19249983pgx.60.1532504424618; Wed, 25 Jul 2018 00:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532504424; cv=none; d=google.com; s=arc-20160816; b=BelVGR6fU4jqymv79iqqwWc7i16+qem+gdP9JPJ994uPYzQmbq5ejkvkpYSJsPUuSZ xdLNL/PlpfcmtZuUKrm769SIi8fGIQTnRv/TCEjo4WGUA/4ZPhtUs4QklVj07Fwjq0W3 goa1C3unPNOFszk/fWojOQkC4ljexZg4CWntspvcQrgttwWQ/O1wIyI9dSzQJ3KiSHq0 0mhv6TChR28YdBZsbZ2NacdljEtka3oj+EKjSGHLkJP9S4ey3OQMKngCSjuOyE2Zd8Lt FKGpTESKpv6hmwdUNj3ipp0A3YGHPvDyMTz18qfaSd2S/XyRDw8udlS7BfXwJAkGd0ZI 1dYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=cSt1pwQsxGzBw3uquJPq4af2a8gX01/8NUMRtpKzH84=; b=DmH5UYze3jBYmW+2yZ1g6bOnlI+ZRxNjmKL0F6kitDuPrTl+Vkj70U9R699KC5XKTD CNqIMXzVEHUbHwNFFtD/EprcoUw9GLPkCU8ZY1V5d58jJ8FbXEIYAJcG8iBPy7WCOk1h yiTDghc3bkZf84RwvSZV9udR4ZhQSHEekBJwUpj/6cljOIvQiIwPBgiBr8UJ0FTqvhHk 8b+QBfi1h2CG9RTM9QhELWOOym7s9vXtFtTXkY//No3kQx055pESzfHtI0/YDHQblOW6 fwyIlaux2onnHurgoy3r+p86M8SgdPtqRSHY/YpjnkD/IQbFWd60j6NMX1fQDQ1UeTYq fuWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XQxr2vkb; 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 y5-v6si12823693pgc.493.2018.07.25.00.40.09; Wed, 25 Jul 2018 00:40:24 -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=XQxr2vkb; 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 S1728504AbeGYItF (ORCPT + 99 others); Wed, 25 Jul 2018 04:49:05 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:52290 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728421AbeGYItE (ORCPT ); Wed, 25 Jul 2018 04:49:04 -0400 Received: by mail-wm0-f65.google.com with SMTP id o11-v6so4938230wmh.2 for ; Wed, 25 Jul 2018 00:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cSt1pwQsxGzBw3uquJPq4af2a8gX01/8NUMRtpKzH84=; b=XQxr2vkbGxb5Npumn7LinVcpj0de4epDl3HQyGlzcyj+oyE07jW3UHqUXqtTbdwK1T cVrBuhgCAPb8ThnG4OGRSMkzBz7qTCbwmjk07dvdCRDl1r+daD8Kaxz/gABqrW5bQJXu 7dAQCRXeFlNY9qhpngSrJAnEo+CFOItyzMbiY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cSt1pwQsxGzBw3uquJPq4af2a8gX01/8NUMRtpKzH84=; b=ivRbbiw/fa7GBaj0zmTjIB1zoM8To1JdsirZG0lnujvgg/Wr5WVa9C39MddkiB2jlv 7heCWzo+S2pz5zHzhKLvVDCvLdXDFPjPwnArDigu5aXpdk8e6nuOluX1jPAznk52iXIE bUpSqZeJBsjJW9nJDtboy7J0DmMuqqXuGHJuq0OHJntLF8NNOD6Jt7cgSRSm3zCy2j7N hKMHXbgIDDUgQD0wzDYj5Ci5TR7+COk+jTsVu+EnfNMj7I/JGTbkHCCibJq8IQ6bPIPH dF82O6pSxiCo+j4KpUNkEgIdjtVzkNPa9dQCcxfagdCNwipqcox1v2Uwn/fWzpb+uAc6 5kfA== X-Gm-Message-State: AOUpUlFdyOIS362COEQJqj0iXdtVui8g3bfeuDv9lWqgNSmP1+Ze068v 5S9YScu70i5Vz3RshPurC15ATQ== X-Received: by 2002:a1c:8406:: with SMTP id g6-v6mr3666024wmd.18.1532504318356; Wed, 25 Jul 2018 00:38:38 -0700 (PDT) Received: from wychelm.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id h7-v6sm10243795wrs.8.2018.07.25.00.38.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jul 2018 00:38:37 -0700 (PDT) From: Daniel Thompson To: Lee Jones , Daniel Thompson , Jingoo Han Cc: 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: [PATCH v4] backlight: pwm_bl: Fix uninitialized variable Date: Wed, 25 Jul 2018 08:38:30 +0100 Message-Id: <20180725073830.31421-1-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716210241.9457-1-daniel.thompson@linaro.org> References: <20180716210241.9457-1-daniel.thompson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Douglas Anderson Acked-by: Lee Jones --- Notes: v4: - Remove line break from Fixes: and update the *-by:s 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(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 9ee4c1b735b2..bdfcc0a71db1 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -250,7 +250,7 @@ static int pwm_backlight_parse_dt(struct device *dev, struct device_node *node = dev->of_node; unsigned int num_levels = 0; unsigned int levels_count; - unsigned int num_steps; + unsigned int num_steps = 0; struct property *prop; unsigned int *table; int length; -- 2.17.1