Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2894540rdb; Mon, 4 Dec 2023 10:17:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEiPLsSa/HpBu3V5zcUeOOyZSQpPy3sLN2f40JGGMkDkuAMzK9uXlkH4PHbUWjyoNCXhB2 X-Received: by 2002:a17:902:b210:b0:1d0:6ffd:9e04 with SMTP id t16-20020a170902b21000b001d06ffd9e04mr4037201plr.86.1701713835019; Mon, 04 Dec 2023 10:17:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701713835; cv=none; d=google.com; s=arc-20160816; b=Pp+YvwL9fMRziMwT3A6iV5oW3IdgaoBv6SGBdvqsjcHgNoaF0SUoboDVEgllAXBZ7x dyi0RcDyJ0mVOkh0LXkgY9azv2d0JcHEqGcT1dScZM8Sttle1sccYpD6yO0xYYOHg2ZA UzeEX0meO4vj4muqmTcwgXZlXffu1kj+ANPQtRBQyWy0tRW2pizCzDcXrovHJvFRZ1gp 2Zf0Fvd1qUU7WJn7iPyNGBis+B8rEOyVacsDInHUQFdLqfTTYdM6jkBILNgABHlL0HYm lvXbgMesqMjV+D5dUYc1YS5LKGbFcz+rmae8h8zH1jPJjuBlp5WcQT/ThSGhBjCOKMqx QA0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zKrXivUU4s4Ix2KPkaOEslUQnUKTTONTEc2Vza38tik=; fh=ip/ReUgbAdiCih6pv53ThEVT4fVgWS0/mHlkk4qe+G4=; b=jABsR1Ebb2k9q51U9JkDsN3T4mhTQcdlAxTwQViZCiJiBaMD5ajvO1MwAKBT7KpTmc J7Pl6CKtoCtHsjtnbvONQDYNiu4CM6Bbemf2gmkAlsTcvKxR8xmycY8cHTqAd9rnx/w7 RlExR1yFuYICHwMc+u3xGS2CXSRFdDasp7CFa4kekQnoFT+SVmA0kOJ29pK5sCAHblHH mN7I/GBjGta8UzH5Z/TIybvUiPWeb4gM4f9e5Uk3ndcKVxTNfbULOB1Ld+hBF4VQoRlf fLy28gzoHNf8LcZifp2dKXBW1ylsc+hw/NlkFFBBnXeYrvfH/sZTCjZTNcAKyUex5SkA XWLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=j1Huygik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id y14-20020a1709027c8e00b001cfc4215864si7861146pll.588.2023.12.04.10.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:17:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=j1Huygik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6FDCF8050019; Mon, 4 Dec 2023 10:17:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229518AbjLDSQ5 (ORCPT + 99 others); Mon, 4 Dec 2023 13:16:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231783AbjLDSQz (ORCPT ); Mon, 4 Dec 2023 13:16:55 -0500 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC5D102; Mon, 4 Dec 2023 10:17:01 -0800 (PST) Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-67ac0ef6bb8so8697936d6.1; Mon, 04 Dec 2023 10:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701713820; x=1702318620; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zKrXivUU4s4Ix2KPkaOEslUQnUKTTONTEc2Vza38tik=; b=j1HuygikMrss4wFMFaflL5a3Q052DFQw7th+z96H0bHVSeojVlDQ7GuPTTmUI8UcC3 ia1ncSq6P3bFs2sIsYVL4PTa0osLuXOX0KH9JOkDcdakzcDcuwy2QaU3HA54ez9a5weZ hryza/0SOF0IHkgR0I3GAy6620Rtf3t462zXKEEa/E8tphp5YK1dMwXeJEypH93EOHdV zKWnwXOGRNnBd2vhpdHJuv8c0HASA245Ig9f++Y4i0skwDbWfJ2nbs2p9TzZ/D2Jsw2c sP/SwOMPIOCZK3/gn0zawuyDTRS/lcpR47880h0Z43Py8jOoG1WPwslcvtKjMfdMN9Ug HyFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701713820; x=1702318620; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zKrXivUU4s4Ix2KPkaOEslUQnUKTTONTEc2Vza38tik=; b=Eo1fJlTdYNxlvwTA8xLdAFmUDVKRiUUcXXxjEQnDAOl227X7bHtX74+srUBCS3cLtN ewLUHTrb5cC5ulapo4UKDLFD52v9gPDMq4uWVPX/F7NgtCeu6Gbv6eVTnHwbosFxIBQ/ 05Y1jvZXG6rXzk7y0lNJB+vVhWgr2SMfeTPnuI5NyAQmJ+yca4TVXML8+ZbtK4GPYSGf I7zZ7iQr/Y6c6KaH1AdEdFVrhjz3lK4fPq6qLB74egVPyPcEfkNYmEzNMCQ0lhfRhS6c JLGirycTQ+vYi6PHZm29z14mzNPzRXA/sGijPvAPNYnZZUn3joZfOmFZKctz2FOWSuCA FotQ== X-Gm-Message-State: AOJu0YwLYF815m/ypcI7NP9DS3HMAlWzuEZjtRhIW15HhEVpFkFzVhyl EgoNQx0noNqV1uNZdIIiclu4gLQ/v17WSjDq0X0= X-Received: by 2002:a0c:fec7:0:b0:67a:cafa:ce13 with SMTP id z7-20020a0cfec7000000b0067acaface13mr1629751qvs.53.1701713820408; Mon, 04 Dec 2023 10:17:00 -0800 (PST) MIME-Version: 1.0 References: <20231204180603.470421-1-gnstark@salutedevices.com> <20231204180603.470421-5-gnstark@salutedevices.com> In-Reply-To: <20231204180603.470421-5-gnstark@salutedevices.com> From: Andy Shevchenko Date: Mon, 4 Dec 2023 20:16:24 +0200 Message-ID: Subject: Re: [PATCH v2 04/10] leds: aw200xx: use devm API to cleanup module's resources To: George Stark Cc: pavel@ucw.cz, lee@kernel.org, vadimp@nvidia.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, hdegoede@redhat.com, mazziesaccount@gmail.com, jic23@kernel.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kernel@salutedevices.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 10:17:12 -0800 (PST) On Mon, Dec 4, 2023 at 8:07=E2=80=AFPM George Stark wrote: > > In this driver LEDs are registered using devm_led_classdev_register() > so they are automatically unregistered after module's remove() is done. > led_classdev_unregister() calls module's led_set_brightness() to turn off > the LEDs and that callback uses resources which were destroyed already > in module's remove() so use devm API instead of remove(). ... > +static void aw200xx_chip_reset_action(void *data) > +{ > + const struct aw200xx *chip =3D (struct aw200xx *)data; > + > + aw200xx_chip_reset(chip); > +} > + > +static void aw200xx_disable_action(void *data) > +{ > + const struct aw200xx *chip =3D (struct aw200xx *)data; > + > + aw200xx_disable(chip); > +} They can be made oneliners. ... > + if (devm_mutex_init(&client->dev, &chip->mutex)) > + return -ENOMEM; Do not shadow the real error code. --=20 With Best Regards, Andy Shevchenko