Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8275031ybi; Thu, 6 Jun 2019 09:25:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQcmohTVEAlgML6BUcD43fWOZ+K4MHR8bnIE/N1CGvdzUGGMpr5mSZaREF0PSS7erwo2ef X-Received: by 2002:a63:1c16:: with SMTP id c22mr4286031pgc.333.1559838359776; Thu, 06 Jun 2019 09:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559838359; cv=none; d=google.com; s=arc-20160816; b=JTvS9Ewam4Yjx7rnB0oeacpKG5l37aiXNutTj88EqmK0Mx2GwyXWijNGdd7Zajs22s 7qs7aLoqWD7/aeROutExt+MGMo1hvqeFshVjTBHiQvuxBD+QrBZfw+mlVp+J9Pk+a9kj 5XfuiJ3qHzHQJ3IujO/F+11JtmXohSS3PDx/9B/5XD1O9npuBslW8T/8GpO0ka6UZjje wDWGwR2DkBXR5iBuLTcKshLXagOk70KiDNrgJqc9/6hWi4d+ka/LzRcjySOwbtrnSbv/ hhiBDZs13qt/kQnkAfXlgHAPbMM3moAMjm/ayUHMi0GvCTr+ZcfdtQ/tT7KdDrDtXvIz HIRg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=nPJqc3vdUNd0fJChWzEpH4QLHcr3Pgehw87bped+Idc=; b=UVWRH1E+LXO9XhdsL49Kq20IPKJCppI7sYIL7f95hUU8HgH++/8xdtG5gxmNQJhTyY nuPDNkFniSQLKNTqsNjdqmcgH0JwV+vqQGWxmT0bFK+QtDuvwcHbpULLMaIEQiKGF4yg XE0F4fO7+VYwOy6ReCNLau3DB3Vx1D0MzDyCqZyBbHnyBxW6s+VLE4d28Lc6Tj/1Sdqf 5bZZVIMs+j5a0P24TPIHcIhZpgMdCyb2xGkRH1xXz+Lj/4FM4mfRFZ/qgPJwqUXW9G4f T6j3QSV3s8sZIeO6/vEDS95EiW8VN2zYL44Vw2DM7S6OQFddWUCmmWiuiC5I3TDyQ2RN LDMg== ARC-Authentication-Results: i=1; mx.google.com; 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 a13si2178999pjo.32.2019.06.06.09.25.42; Thu, 06 Jun 2019 09:25:59 -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; 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 S1728042AbfFFKHK (ORCPT + 99 others); Thu, 6 Jun 2019 06:07:10 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:45861 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726972AbfFFKHK (ORCPT ); Thu, 6 Jun 2019 06:07:10 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id B88B4803EB; Thu, 6 Jun 2019 12:06:56 +0200 (CEST) Date: Thu, 6 Jun 2019 12:07:06 +0200 From: Pavel Machek To: Dan Murphy Cc: jacek.anaszewski@gmail.com, broonie@kernel.org, lgirdwood@gmail.com, lee.jones@linaro.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 5/5] leds: lm36274: Introduce the TI LM36274 LED driver Message-ID: <20190606100706.GA1825@amd> References: <20190605125634.7042-1-dmurphy@ti.com> <20190605125634.7042-6-dmurphy@ti.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bp/iNruPH9dso1Pn" Content-Disposition: inline In-Reply-To: <20190605125634.7042-6-dmurphy@ti.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > Introduce the LM36274 LED driver. This driver uses the ti-lmu > MFD driver to probe this LED driver. The driver configures only the > LED registers and enables the outputs according to the config file. >=20 > The driver utilizes the TI LMU (Lighting Management Unit) LED common > framework to set the brightness bits. Nothing too bad, but... > +static int lm36274_parse_dt(struct lm36274 *lm36274_data) > +{ > + struct fwnode_handle *child =3D NULL; > + char label[LED_MAX_NAME_SIZE]; > + struct device *dev =3D &lm36274_data->pdev->dev; > + const char *name; > + int child_cnt; > + int ret =3D -EINVAL; > + > + /* There should only be 1 node */ > + child_cnt =3D device_get_child_node_count(dev); > + if (child_cnt !=3D 1) > + return ret; I'd do direct "return -EINVAL" here. > + device_for_each_child_node(dev, child) { > + ret =3D fwnode_property_read_string(child, "label", &name); > + if (ret) > + snprintf(label, sizeof(label), > + "%s::", lm36274_data->pdev->name); > + else > + snprintf(label, sizeof(label), > + "%s:%s", lm36274_data->pdev->name, name); > + > + lm36274_data->num_leds =3D fwnode_property_read_u32_array(child, > + "led-sources", > + NULL, 0); > + if (lm36274_data->num_leds <=3D 0) > + return -ENODEV; > + > + ret =3D fwnode_property_read_u32_array(child, "led-sources", > + lm36274_data->led_sources, > + lm36274_data->num_leds); > + if (ret) { > + dev_err(dev, "led-sources property missing\n"); > + return -EINVAL; Should it return ret here? If read array failed with -ENOMEM, we may want to propagate that. > + } > + > + fwnode_property_read_string(child, "linux,default-trigger", > + &lm36274_data->led_dev.default_trigger); > + > + } > + > + lm36274_data->lmu_data.regmap =3D lm36274_data->regmap; > + lm36274_data->lmu_data.max_brightness =3D MAX_BRIGHTNESS_11BIT; > + lm36274_data->lmu_data.msb_brightness_reg =3D LM36274_REG_BRT_MSB; > + lm36274_data->lmu_data.lsb_brightness_reg =3D LM36274_REG_BRT_LSB; > + > + lm36274_data->led_dev.name =3D label; > + lm36274_data->led_dev.max_brightness =3D MAX_BRIGHTNESS_11BIT; > + lm36274_data->led_dev.brightness_set_blocking =3D lm36274_brightness_se= t; > + > + return ret; I'd do "return 0" here. It is success. Yes, ret will always have that value at this moment, but... > +static int lm36274_probe(struct platform_device *pdev) > +{ > + struct ti_lmu *lmu =3D dev_get_drvdata(pdev->dev.parent); > + struct lm36274 *lm36274_data; > + int ret; > + > + lm36274_data =3D devm_kzalloc(&pdev->dev, sizeof(*lm36274_data), > + GFP_KERNEL); > + if (!lm36274_data) { > + ret =3D -ENOMEM; > + return ret; > + } Just do return -ENOMEM; Acked-by: Pavel Machek Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --bp/iNruPH9dso1Pn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlz45coACgkQMOfwapXb+vJpUQCglh9YImf4M842218a0pSSEMiW hhUAmwQ5kL54IV8eBFctVi6Aelt85+0u =5jN6 -----END PGP SIGNATURE----- --bp/iNruPH9dso1Pn--