Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp2495216qtg; Thu, 23 Mar 2023 04:48:57 -0700 (PDT) X-Google-Smtp-Source: AK7set9X16F9m47MbYmZeJ8OthzyKFjhJy860SGNNYs8iX9JNoFL/HrvyXh1Qehv/zz21XbzxRX+ X-Received: by 2002:a05:6a20:b911:b0:da:c080:9b86 with SMTP id fe17-20020a056a20b91100b000dac0809b86mr3144702pzb.53.1679572136782; Thu, 23 Mar 2023 04:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572136; cv=none; d=google.com; s=arc-20160816; b=IdSnmWNhRn9Ug66sVue126uYJPvhg5Ewq9UeEzFrQGaRlapxesYP27eBTN9V1IdwqA /aZ1rnKtnUDmx8BuxHT7jnyj6gio2gVUpiqK0RbI6fU36PM0HR6M8LpHJkIyYsWo60eH KAA+/6AfaKMeH4wmKdLLZoiz3aHy5Ye88YpWd1uU47yOdyvLnAVt2YJVBWs9wbGvt7bf 2XI3NZbhZSJqzhN1X2znK0UrwZ1VGSMHZYLTVWgLRoEz8ArPPpjUpFA4scUE9+tRi9z+ LEl12+12y6ZHSYvGUk2VRP3AKHuVq+4A+01pvfea6ga3WbHQxuH4s2ZqQ5DNXSOiWptK GbEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k0rrIvndFDk2UOKYFKfhmbgQ2OShZHYtdx/lmRxqCsI=; b=bh/7wCj8KaNkTDKW3q/mGDy8JXc09xyrybFN/qPfCnBAGtUUkXIavBZqOHr6s8dtOb Nscf6/L3sy+K9deUUeougE9tk0z1BhcAp/0opSVjzVJTy/E2dRzcg1ecgNEHfiULOU53 pJZA3QU5wlaycl4tuGPksR5hhvJlC+d6xBKd7kS4b13w0cv6Ba6bzpXksWQZpLo4+8do zTqkNnhzAGkcg/jVA9JbGrdZ2xh1jRD03/gHBmZBZ6ZED8i5QJBnlfa3ftA9tyVhf/Zk x8xodDjykl/3p9dw1qY9uunB836j5FMZKzJ+pwwg0LqLi5ek+bkLpU9TTpmNAK+MWv/E 08dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=B4nklH9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a62f246000000b00628f842de7fsi4090167pfl.224.2023.03.23.04.48.44; Thu, 23 Mar 2023 04:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=B4nklH9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231720AbjCWLqz (ORCPT + 99 others); Thu, 23 Mar 2023 07:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbjCWLqx (ORCPT ); Thu, 23 Mar 2023 07:46:53 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2DF030B09; Thu, 23 Mar 2023 04:46:52 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id B850D1C0E45; Thu, 23 Mar 2023 12:46:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1679572011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k0rrIvndFDk2UOKYFKfhmbgQ2OShZHYtdx/lmRxqCsI=; b=B4nklH9msojf8m6XTHzD04Hi0iBL4hGsnxkDsCXlp6meILDSgRM4e6uIF21lGD2WR8rJwO lLaZk4QXxCrzJSzyfGxr3o3hCI0obMg3oYEEOA9eeqDh2Lcl0diOugZ1ET5QU/PS8ETkdh tGPD0VTucYf1px0Er2zhCWJRFKJGvb8= Date: Thu, 23 Mar 2023 12:46:51 +0100 From: Pavel Machek To: Naresh Solanki Cc: Lee Jones , Patrick Rudolph , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [PATCH 2/2] leds: max597x: Add support for max597x Message-ID: References: <20230322124316.2147143-1-Naresh.Solanki@9elements.com> <20230322124316.2147143-2-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WvSCQyaudfTEwz4M" Content-Disposition: inline In-Reply-To: <20230322124316.2147143-2-Naresh.Solanki@9elements.com> X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --WvSCQyaudfTEwz4M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > max597x is hot swap controller with indication led support. > This driver uses DT property to configure led during boot time & > also provide the led control in sysfs. Can you provide dts example showing how you'll use it? > Signed-off-by: Patrick Rudolph > Signed-off-by: Naresh Solanki > +static int max597x_setup_led(struct device *dev, struct regmap *regmap, = struct device_node *nc, > + u32 reg) > +{ =2E.. > + ret =3D led_classdev_register(dev, &led->led); > + return 0; > +} > + > +static int max597x_led_probe(struct platform_device *pdev) > +{ =2E.. > + for_each_available_child_of_node(led_node, child) { > + u32 reg; > + > + if (of_property_read_u32(child, "reg", ®)) > + continue; > + > + if (reg >=3D MAX597X_NUM_LEDS) { > + dev_err(&i2c->dev, "invalid LED (%u >=3D %d)\n", reg, > + MAX597X_NUM_LEDS); > + continue; > + } > + > + ret =3D max597x_setup_led(&i2c->dev, regmap, child, reg); > + if (ret < 0) { > + of_node_put(child); > + return ret; > + } This will cause crashes. After you successfully registered one LED, you can't just bail out. BR, Pavel --=20 People of Russia, stop Putin before his war on Ukraine escalates. --WvSCQyaudfTEwz4M Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCZBw8KwAKCRAw5/Bqldv6 8r+4AJ9ueTFs2ZtMyw+f+QrsDX6XsZKc2ACcDQ/MIxL3p+o+WwJ0oFt/r3gvAAw= =4Jjm -----END PGP SIGNATURE----- --WvSCQyaudfTEwz4M--