Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3625987yba; Tue, 23 Apr 2019 07:03:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4LxyfYNWr840eJS+ltIMBfqgeCppC8UGidccSX1bI5/0nVe3EorZZX3Ol0+oWLNK3FoWk X-Received: by 2002:aa7:81d0:: with SMTP id c16mr26532772pfn.132.1556028223906; Tue, 23 Apr 2019 07:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556028223; cv=none; d=google.com; s=arc-20160816; b=YgBV6ve3m/hdprmPH4AdFTID97/7LVTNqfLDn5jG5ne47S8NvC9oyexqrKLzd96wWj OmmsV9D3GvzlaZDu4EIwCzL/jEF/MtjQgoWRMbgHiD4+fyDX5Tsx4EwHpQe2bsl146ET yxa+V7Kl5IGM/dFMt6ZfC1nljOdf/LEIli4XO17MA6bL+03EAOG32asxdjHjimnwRW1S qTxhp7KTYZgbvHD3WHmLDlcagc0yuiHgCXorUfFCZvR7rfpFl1XidCmHoD05wKVctkv+ Lpyb1CntFmUN6TMuwFneKma6qywIczqzPMStVz+NrZUTy73RVlLSGe9AYK0+0UYH9OQD F6nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=C+lbExyUyM0Rv0dzDhmPUOJlyBBzQVvoW2uEvb3F7xc=; b=HuYuQRar0/IfVf+ViSl9SpRigS4hr9uGoeSpJMQOnboz0C+DoF/TyfNsiQrsDamK3J iqkikZ4hy+0PAGDxxTWRGSGirSl7suhzKgxxXG+f7qWBt0s7c1/961lcD4AVqCfyJQ3O Q4KIxuC/1AL1eKtgxMwjH+5mjpzCzYtcMHkrZB4x7GaOZwylYmkEuLD825Fhdz+xnn2B UMCh6u4UAJ8fy2pFguOypE6qF612eq/idbE9cxyGcDDakopuhuyyser2u63afVYJWTfY Nq6E6dioaNoEVwZsvcruR7YbxRCEmcRAGDHWmOO72LvcVvOHTYmtWl2v6JGEL61plbyO aXDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@onstation.org header.s=default header.b=k4OxyZlz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si16398941pff.225.2019.04.23.07.03.22; Tue, 23 Apr 2019 07:03:43 -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 (test mode) header.i=@onstation.org header.s=default header.b=k4OxyZlz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727909AbfDWOBw (ORCPT + 99 others); Tue, 23 Apr 2019 10:01:52 -0400 Received: from onstation.org ([52.200.56.107]:35408 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727180AbfDWOBw (ORCPT ); Tue, 23 Apr 2019 10:01:52 -0400 Received: from localhost (c-98-239-145-235.hsd1.wv.comcast.net [98.239.145.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 135293EE68; Tue, 23 Apr 2019 14:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=onstation.org; s=default; t=1556028111; bh=oYGR0hjvSNwgsPFOiD8HrQZMCp/hcytoqTsEFpcLUPE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k4OxyZlzeoTsqKH6nhE0RkZkexsX4lrkr4IX1sWZPCIM0aLlntZ7oALmegma/yAkG 7KSyAtZ+FbfIa2YxocuGzsmwm46Z10KOIaN+0VHO8ZgnnvO0LELb+BYdAt2vg4vXC0 jyvTlF7KsCR9H/1Obcz8hfB+TTqNiNsRO/WXdwxc= Date: Tue, 23 Apr 2019 10:01:50 -0400 From: Brian Masney To: Dan Murphy Cc: lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, robh+dt@kernel.org, jacek.anaszewski@gmail.com, pavel@ucw.cz, mark.rutland@arm.com, b.zolnierkie@samsung.com, dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, jonathan@marek.ca Subject: Re: [PATCH v5 3/3] backlight: lm3630a: add firmware node support Message-ID: <20190423140150.GA10071@basecamp> References: <20190418151143.26068-1-masneyb@onstation.org> <20190418151143.26068-4-masneyb@onstation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 23, 2019 at 08:49:20AM -0500, Dan Murphy wrote: > > +static int lm3630a_parse_led_sources(struct fwnode_handle *node, > > + int default_led_sources) > > +{ > > + u32 sources[LM3630A_NUM_SINKS]; > > + int ret, num_sources, i; > > + > > + num_sources = fwnode_property_read_u32_array(node, "led-sources", NULL, > > + 0); > > + if (num_sources < 0) > > + return default_led_sources; > > + else if (num_sources > ARRAY_SIZE(sources)) > > + return -EINVAL; > > + > > + ret = fwnode_property_read_u32_array(node, "led-sources", sources, > > + num_sources); > > + if (ret) > > + return ret; > > + > > + for (i = 0; i < num_sources; i++) { > > + if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1) > > + return -EINVAL; > > + > > + ret |= BIT(sources[i]); > > + } > > + > > + return ret; > > +} > > + > > +static int lm3630a_parse_bank(struct lm3630a_platform_data *pdata, > > + struct fwnode_handle *node, int *seen_led_sources) > > Why is seen_led_sources passed in here? > It is initialized on the stack in lm3630a_parse_node but the variable is never referenced in that API. It's to see all of the led-sources that are configured across all of the banks. If it is just in lm3630a_parse_bank(), then it won't catch the following invalid configuration: led@0 { reg = <0>; led-sources = <0 1>; label = "lcd-backlight"; default-brightness = <200>; }; led@1 { reg = <1>; default-brightness = <150>; }; Brian