Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp274367rwb; Wed, 9 Nov 2022 02:13:16 -0800 (PST) X-Google-Smtp-Source: AMsMyM6GFEMEEGFQkdcnD7Anyy8e8knLK2vZnRYVb8GBAHMj89ryEasCGvf6dl1z+D5zK/DcDfgH X-Received: by 2002:a17:906:6a1b:b0:7ad:ba1e:879b with SMTP id qw27-20020a1709066a1b00b007adba1e879bmr53176712ejc.311.1667988796448; Wed, 09 Nov 2022 02:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667988796; cv=none; d=google.com; s=arc-20160816; b=a2Chri/BpXI/v6jEhoNQVtXF68ae7zOMIAxi+e76XxUj4KgbUxXS7txXaIGt/Nhs2/ Vwiz1HvJG/vx4dShZTRL18gQDudhVJefFQe7shGKqdcdnHsyApSTkfKcvr95qhG1bu9N vM11Z17yTPosZ01SuK/FqJEBHQsUQj5ysjeafb+ZliSuvrahVwaVz3FlH9sLTSKd9WTt ItRrSUpLhPhpY7TEtHMWgtsjxuoKYXO/3UmL0RXAOnysHnagQ8jHox9zhd5XwRKgOhuE 5RJfDQHxu5HemFxIYNOZbCcZ/w5dRxC/YOMFMZdQfVZ1BBAd7+seMXPGDqaNwuwZH/8/ DtcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=j1eHSYMhfEtkHP5oPHLnWONuCAHsaXf3iVXUSXnqRyA=; b=imUiANbJ9hpW73Q3IvtwbFZWNs88y2Sp+2CfqxQmcDgOouZhdnDT+5d+MjeTrUxTed nfl8Kghh/u6uUg8ckL+zXL7eTtDtRgh4JsMIoMrWYV5DWkcdV9kvxu8VyKVnyd9Py2v0 sEsbDWqQYhtB0O0JFjtFXEbc14Ux5kYN2FnTyGySnlJuzREwoz/YzXBjODp5W2ko75nq 38K15eyhSKJ3XCI0vZT98/OwmAVZTf4AaAZQuaONbfj1mFF2Ib5zTy+MIulbSy8JJpXp i48IzBABWM1zQ3ZFgA/7DBSh5dhrV85MQj+p7VNlGLLfrKDnmC2sqOAINLt8bI4DsGJ8 59gw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz9-20020a1709077d8900b0079b9f472d85si15606362ejc.698.2022.11.09.02.12.52; Wed, 09 Nov 2022 02:13:16 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbiKIJz6 convert rfc822-to-8bit (ORCPT + 93 others); Wed, 9 Nov 2022 04:55:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230458AbiKIJzt (ORCPT ); Wed, 9 Nov 2022 04:55:49 -0500 X-Greylist: delayed 600 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 09 Nov 2022 01:55:48 PST Received: from smtp.220.in.ua (smtp.220.in.ua [89.184.67.205]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1BD02529D; Wed, 9 Nov 2022 01:55:48 -0800 (PST) Received: from smtpclient.apple (unknown [95.67.115.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.220.in.ua (Postfix) with ESMTPSA id 7EED31A21FD2; Wed, 9 Nov 2022 11:39:29 +0200 (EET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Subject: Re: [PATCH 02/13] leds: el15203000: Fix devm vs. non-devm ordering From: Oleh Kravchenko In-Reply-To: <1667983694-15040-3-git-send-email-wangyufen@huawei.com> Date: Wed, 9 Nov 2022 11:39:14 +0200 Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, pavel@ucw.cz Content-Transfer-Encoding: 8BIT Message-Id: <5D15416B-1866-4031-9958-7CD763C0BD6E@kaa.org.ua> References: <1667983694-15040-1-git-send-email-wangyufen@huawei.com> <1667983694-15040-3-git-send-email-wangyufen@huawei.com> To: Wang Yufen X-Mailer: Apple Mail (2.3731.200.110.1.12) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 Hello all! > 9 лист. 2022 р. о 10:48 Wang Yufen написав(ла): > > When non-devm resources are allocated they mustn't be followed by devm > allocations, otherwise it will break the tear down ordering and might > lead to crashes or other bugs during ->remove() stage. Fix this by > wrapping mutex_destroy() call with devm_add_action_or_reset(). > > Fixes: fc19967bcb8f ("leds: add LED driver for EL15203000 board") > Signed-off-by: Wang Yufen > Cc: Oleh Kravchenko > --- > drivers/leds/leds-el15203000.c | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/drivers/leds/leds-el15203000.c b/drivers/leds/leds-el15203000.c > index 7e7b617..9be934e 100644 > --- a/drivers/leds/leds-el15203000.c > +++ b/drivers/leds/leds-el15203000.c > @@ -287,10 +287,16 @@ static int el15203000_probe_dt(struct el15203000 *priv) > return ret; > } > > +static void el15203000_mutex_destroy(void *lock) > +{ > + mutex_destroy(lock); > +} > + > static int el15203000_probe(struct spi_device *spi) > { > struct el15203000 *priv; > size_t count; > + int ret; > > count = device_get_child_node_count(&spi->dev); > if (!count) { > @@ -312,15 +318,14 @@ static int el15203000_probe(struct spi_device *spi) > > spi_set_drvdata(spi, priv); > > + ret = devm_add_action_or_reset(&spi->dev, el15203000_mutex_destroy, > + &priv->lock); > + if (ret) > + return ret; > + > return el15203000_probe_dt(priv); > } > > -static void el15203000_remove(struct spi_device *spi) Is remove() callback from struct spi_driver deprecated? > -{ > - struct el15203000 *priv = spi_get_drvdata(spi); > - > - mutex_destroy(&priv->lock); > -} > > static const struct of_device_id el15203000_dt_ids[] = { > { .compatible = "crane,el15203000", }, > @@ -331,7 +336,6 @@ static void el15203000_remove(struct spi_device *spi) > > static struct spi_driver el15203000_driver = { > .probe = el15203000_probe, > - .remove = el15203000_remove, > .driver = { > .name = KBUILD_MODNAME, > .of_match_table = el15203000_dt_ids, > -- > 1.8.3.1 >