Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2893915rdb; Mon, 4 Dec 2023 10:16:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfcPB0iXh7wRieAIm++34bkKA8pkt3BW6FrniL2iw6nHB8RB1DIxn87zb71Hl1N0zzNoxc X-Received: by 2002:a17:902:7c04:b0:1d0:6ffd:6e5e with SMTP id x4-20020a1709027c0400b001d06ffd6e5emr1809714pll.86.1701713774162; Mon, 04 Dec 2023 10:16:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701713774; cv=none; d=google.com; s=arc-20160816; b=xfYkVjXgewpLM6br7Ow0DKYuWl5G7quMydsSn94YbD7vsuax1LaubGmg2uMV3rMnvQ aU6rJeiEX4sZgG04XRIHaj6zgoUGnBZNthvwpP6AUOBUHHY1PsPNrtzg2iUyTlKGHOCN nLnM3zefmaKsvsr6Bk4KVmHCcp1Ly2MA2sMMbZ1i0siqLzmnFSkyGR2YF8oz6fwA5Dds H4bN8lCgQo0nJZ+UegepjEjEsmW7Nyjhs+EPD+vLNa/KXYaTgrq4grgX7sflNPN3Wjew ExpH/P/W2IYfw7Kb0uf3XsXC3eE666tzh6oEeO+CCPWLC7NAtf5LVt0IZ7UdQmTcek86 yyeQ== 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=TrXoxXZcL5o0bwmshlpciFrBa2ROqvh7a5sct4i1UKg=; fh=ip/ReUgbAdiCih6pv53ThEVT4fVgWS0/mHlkk4qe+G4=; b=myb1221D8imEEIGP9G97MbznD2BoPxgujA0k01Sty9aCLXsaIBHVGvMbdGdCKuAD4w a4D6WMO05KJ8HdjjdfeUVoKV7tCaNKpFEIGgFzv2MFYJloVxzSIhDSlEk6URTTxZUPHM xHRmSv6heqgbPeb+FD2EDIcpEKODYAqls/eWeN34QryG8jxicGgxS8FkRbI6ELG8S3c/ 0/kbeOK5I3houGZBg/MHwA7Egs+sJz3whugrScaW5Hf4DqD/rSJHvl8rNr+vHhnx565W ZI3lEeddMPiw9eY4iOIOo5sWZAS6mu+/rtiPa/d6hpx00NUjHcP65T8zBc4qG9oLDHkT RGeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VNOFqti7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g11-20020a170902934b00b001cfc0272b48si7967690plp.103.2023.12.04.10.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:16:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VNOFqti7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 73299805F438; Mon, 4 Dec 2023 10:16:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbjLDSPw (ORCPT + 99 others); Mon, 4 Dec 2023 13:15:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbjLDSPv (ORCPT ); Mon, 4 Dec 2023 13:15:51 -0500 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6C2BB6; Mon, 4 Dec 2023 10:15:57 -0800 (PST) Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-67abd1879c0so10502236d6.2; Mon, 04 Dec 2023 10:15:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701713757; x=1702318557; 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=TrXoxXZcL5o0bwmshlpciFrBa2ROqvh7a5sct4i1UKg=; b=VNOFqti7W1dvOey8wS/CevNZ6k3q2ayPRlfSliWPGTV3koJeYVHAGkXCKNDhdurzLu PTJhT2+P0NUQVj/tFfmZm5i9mM+d+ovv3+1Xe8GZ5onxct5rwLSSwAUM9a6YSnB43Mu/ YRH0ocq4WbAUILVykqHXROqMlMIZ0WF9JY2+o89WpM0BeVDP9BIeZZvyL3GAjYvl9ugh 6WRxNxAN/jeslzWEvadnIAb7B+v5pXRKJxsTHRj+uGVjAi2jb7KFNvCB0LlW/LQ5x//L l9Aal1g/w7AwpWUlIEIpYEzvLi56JThF/547xXnvKtt/HVfgR5X9kN4sU6wd2cwDWkak WdEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701713757; x=1702318557; 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=TrXoxXZcL5o0bwmshlpciFrBa2ROqvh7a5sct4i1UKg=; b=hAW1Q9WzkDOub318Q6fGznTKrboScFF/3FxaYuEfPE1+csNm35HN6ezzL55PCn18ye H+SPxHov4U9xOGkrNzX9DUYsJuN3Yz1HrfLMKz0ybNSKYPkDMWoD7vFiPY4W99E6x3Ba BRXukuOfNSip+GEzddvDE/iT0ERU3i6UmOCWLKmISVHFOHcFWfqRNzzWy5LoDwKNyVz3 a4Ic6w7ryIB+ICj5vKOyJ6lhH2b4LdbcdNxPK6t32q3OevYEb2VXAwkb1/my0asFPbM0 zW22dbHFMXGKfHmM41WQtXQYu4kxmCD4EoZLXMGvm0ky0/7E+ANHTSWYM/5VRgHwDZTC mzgQ== X-Gm-Message-State: AOJu0YyfFp900RW+4pCUpglKg8H+3Z39WZsbq/kiTU/XHM+SYuXr70RL uXZKC5Q534Of1xrZ13Gj1mqrzBaIkHseu8i0R+k= X-Received: by 2002:a05:6214:1409:b0:67a:96c7:4c90 with SMTP id pr9-20020a056214140900b0067a96c74c90mr5715457qvb.38.1701713757080; Mon, 04 Dec 2023 10:15:57 -0800 (PST) MIME-Version: 1.0 References: <20231204180603.470421-1-gnstark@salutedevices.com> <20231204180603.470421-4-gnstark@salutedevices.com> In-Reply-To: <20231204180603.470421-4-gnstark@salutedevices.com> From: Andy Shevchenko Date: Mon, 4 Dec 2023 20:15:21 +0200 Message-ID: Subject: Re: [PATCH v2 03/10] leds: aw2013: 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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 04 Dec 2023 10:16:08 -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 aw2013_chip_disable_action(void *data) > +{ > + struct aw2013 *chip =3D (struct aw2013 *)data; > + > + aw2013_chip_disable(chip); > +} As with mutex release, this also can be oneliner static void aw2013_chip_disable_action(void *chip) { aw2013_chip_disable(chip); } ... > + if (devm_mutex_init(&client->dev, &chip->mutex)) > + return -ENOMEM; Shouldn be ret =3D devm_mutex_init(&client->dev, &chip->mutex); if (ret) return ret; ? > + return -ENOMEM; --=20 With Best Regards, Andy Shevchenko