Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp984854rdg; Fri, 11 Aug 2023 06:27:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMxz/SYAaSgwoOv/eq4fzriMyDBbIblhhf3viHomEn32qPZeAgKVMfPxVHmHVo0r/y706w X-Received: by 2002:a17:90b:fc3:b0:262:fa59:2908 with SMTP id gd3-20020a17090b0fc300b00262fa592908mr6795279pjb.1.1691760448840; Fri, 11 Aug 2023 06:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691760448; cv=none; d=google.com; s=arc-20160816; b=wqz/2K2hDUqpyhXKmf5IU8EMhcJ1vBnuyUGmBZIHCEykDkLqXKI6SGvdQufJoy0bZG xS+faq8r5ZWBoVzkCtHYcdNzYPsF12NJxRiSzZ4lEp2Gy6FHhYdZvVmKuZrMhYYrZYJy F4p+VVk0sUqRcbFF+wfb3ZApx07cGpBfWx9YZWOaDrYadD8IWGtypNOUiQdtlBm0jPZl u/GXROc6R0Phm4+eYS2qSVcBJgOUjc8GBXMwtz9zhzZl3JA/v3gG+2QgK+VPRirS1kwI n7nPTskLLHc50IukpgvDtKwEEWU+IvKc5uLozGobV87nCGAp1UcDHr2YKeUKOrW2mTMJ /esA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=ZzaCKTGz2sPx6OTPXSZ8wj/VVvy6e53lpSCJsrwlWFE=; fh=U3wO8OjtOiol1NLL1Tea225ywF0wDQH/x7n0HRCwKfk=; b=Gr3ujjl0W7xwZvkmKmzCryZPny+mw0J4ZUsU7QrzuTCw3BJdLYCaoN+upE12ZI9gvL fRhsqbyCDXfNNMxEuBN6JQLLhi5ovktZvP2nRrzE6DNgTR0cWGlMuSNgfW9k5O0NLNt+ joCgt7g+i8h/T2MdjRDkXKIzhyX/s/GnAzUgmAQM0DTuAAw22/vaYO6esLA0iuJ3luOU XSB8Mi01u2C3EVP+74vyPF2anQDQe5hR9F1UwEUgWNYsv8/PR44epQXHnx58HcFD7OnT nqijmHQ8TeqahQGM92SRZPh7om0MJy0AQ4Ds2ZpChmek53ew69fsINPKbMi+neKsvib/ hgEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=aXhkgxdC; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a17090ad98300b002633c436f4esi3408285pjv.34.2023.08.11.06.27.16; Fri, 11 Aug 2023 06:27:28 -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=@bootlin.com header.s=gm1 header.b=aXhkgxdC; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235131AbjHKMi0 (ORCPT + 99 others); Fri, 11 Aug 2023 08:38:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjHKMiZ (ORCPT ); Fri, 11 Aug 2023 08:38:25 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D2730C0 for ; Fri, 11 Aug 2023 05:38:24 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6BAD160008; Fri, 11 Aug 2023 12:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691757503; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZzaCKTGz2sPx6OTPXSZ8wj/VVvy6e53lpSCJsrwlWFE=; b=aXhkgxdCHezeh8D5FzId75JChuUm1RwyLyO+ALkTBeuAAjMoJjbGZwdPfW0mTY6aB2omrs PeVNci4QGNHEsS026jsZhmSIjtKzgBkjCzL/ZHSqP0JPsJ7YWEGaLjnVJuJ63k2YEWvOKN 2RiMr4sczB0GltBBVqh5V6XZo2x3Xe1F6610YRhoaui50Y8MrGLbKLIBY8iixG2LCqGl1u 2taFYcVROyf49qy11c2COcwhW4g78dOa5eTz88nLVMjNY97iDCSPvvX75I1cAFbzfGsRir UKT5IYGyy7oWrf3tWDhbIeOHBNwPLFjXc4LLU+pjpAae5JjC+BRqf3MPIHKhnw== Date: Fri, 11 Aug 2023 14:38:21 +0200 From: Miquel Raynal To: Srinivas Kandagatla Cc: Greg Kroah-Hartman , Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , linux-kernel@vger.kernel.org, Randy Dunlap , Chen-Yu Tsai , Daniel Golle , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= Subject: Re: [PATCH v9 1/7] nvmem: core: Create all cells before adding the nvmem device Message-ID: <20230811143821.29cf335a@xps-13> In-Reply-To: <154883fc-a6bc-01a9-b044-dac8848e9963@linaro.org> References: <20230808062932.150588-1-miquel.raynal@bootlin.com> <20230808062932.150588-2-miquel.raynal@bootlin.com> <20230808092433.039e2f48@xps-13> <05aea50f-6692-962e-abe7-765197815f03@linaro.org> <20230811141122.7921df1d@xps-13> <154883fc-a6bc-01a9-b044-dac8848e9963@linaro.org> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED 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 Hi Srinivas, srinivas.kandagatla@linaro.org wrote on Fri, 11 Aug 2023 13:26:24 +0100: > On 11/08/2023 13:11, Miquel Raynal wrote: >=20 > >> > >> =20 > >=20 > > nvmem_register() calls device_initialize() and later device_add(), > > which is exactly the content of device_register(). Upon error > > after device_add(), we currently call device_put(), whereas > > device_unregister would call both device_del() and device_put(). > >=20 > > I would expect device_del() to be first called upon error before > > device_put() *after* device_add() has succeded, no? =20 >=20 > That is correct afaiu, if device_add is succeed we need to call device_de= l(). As the patch now moved the device_add to end of function we really do = not need device_del() in err path. Right, I'm looking at the end of the series where I need to add device_del() in the error path because something gets added after device_add(). So we are aligned, thanks for the feedback. > >>> I also see the layout_np below should be freed before jumping in the > >>> error section. =20 > >> > >> you mean missing of_node_put()? =20 > >=20 > > Yes, I need to call of_node_put() before jumping into the error path. = =20 >=20 > Are we not already doing it in nvmem_layout_get() and nvmem_add_cells_fro= m_fixed_layout() ? We perform the layout_get for two reasons: - knowing if there is a layout - using the layout Here we are in the first case, and we don't want to retain a reference from here. Only in the second case. Thanks, Miqu=C3=A8l