Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp127041rdb; Tue, 31 Oct 2023 02:54:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEceXHlsGCB9pzqWJrgu8bfwEwXAaVt11OxdyhgeG11UEBRJbARIWtAzhIF9OFD2zWvFGq2 X-Received: by 2002:a05:6358:90a:b0:169:58fd:2f7b with SMTP id r10-20020a056358090a00b0016958fd2f7bmr5619897rwi.6.1698746096539; Tue, 31 Oct 2023 02:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698746096; cv=none; d=google.com; s=arc-20160816; b=0vVKaoRrOcwgYT96s2g+u3UhSaKyQ6ZKJE2J+Is4S5mbwdvOtmSxvi55DoherRef0S U1/uWBKqJIt8kpYOMmmBbhsN5uXuZQJP/H52srhsBoMJF2u7eyZfoHsyaLwbHK1PZR8/ dauBvg+8TjIzr14A+AoUxyROAwLlSKK92OhiLOvVusqLwj2oC3IN8RAtHm9H7hcotbHH r+Mrg/W1r44aUDKroOgJAuBWdaERVKJhiM4ACrg+jwjn3ne14RPQ/nmLmbQeYmy2ERU7 3jrLlatd9QFCe2N4dNJNG1vlyXlCOrqds4gj/qiXH2olzJEijTn+GitxRKnTVQinZe9J zAlg== 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=+ChJmbwu9VOnS+POuHp63gRk5wbYb/ywo5ZD9wSaeEs=; fh=cWa9aeEHCPU6FskROxfB7XR8DGiPD/6c2wNJ1+Lk9Qs=; b=u92NUrnArflii+qyH6rQTtcKLD8EfJz4gPYOwawIlD/jG0J8GgTJn1qauvs/V9E3Kq KBp/uhK/u0sm4U1h+N7gT4Xs2JbE9EZHNJ2KhDGn4VA2+KTmmbJ7bzabTe729MZc4lwX 5NKpPiRAv87NwpfWK06Etl/V25s8jHEqnot5YTc4I3ubJ63lJ8nM99Y392uoiEorVJEG 9xWHD+ubyIth5p/lgxhhQvv9XfeQppIgNsos0n3L6xtT4Uiuva3ncm7IwwQxy8orT+0J m6y5HhJ0RvtI4PGAGNgEqZvIbobPmtFh2SQySJwqxF0nMe1uX4pwxzs3SlkFyEA+Epas d0FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JgjwshRE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id l24-20020a63ba58000000b00584a4a5be67si808887pgu.520.2023.10.31.02.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 02:54:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JgjwshRE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id F2C8180B7AFC; Tue, 31 Oct 2023 02:54:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234938AbjJaJyo (ORCPT + 99 others); Tue, 31 Oct 2023 05:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233751AbjJaJy0 (ORCPT ); Tue, 31 Oct 2023 05:54:26 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42FE91B4; Tue, 31 Oct 2023 02:53:36 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 772AE1BF206; Tue, 31 Oct 2023 09:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1698746012; 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=+ChJmbwu9VOnS+POuHp63gRk5wbYb/ywo5ZD9wSaeEs=; b=JgjwshREE8Ep4u5oBUOhPDbbNTHxfx0Z0WE37PioXBaiJ9B/irqONtAXNFueoA0H8LSIk7 W/QZH9YcMhG/mvGUa8ZNPCKR5HWzorw/ASJOBLiNw0jXToKCR9xKli6ZWK9T0cruBVWooh OCMN/24k2VgD0AKzf3Cm0O+mjGxRYzoaXYwftBXcOesV+CPwWG6wy+2Rxqqjhv0+txGObD E0Y4ZWcNNrHRROiMom3iaKwC85TkbRTsLmTRIEJWcf6iXDHZ3fEVtZ4HOTl4OsKY4SYfnv IQwB+IbERhT2lQRIK2SxM1Nc+22WSPOmoDpP7l5oXPJffTEgtkIyWVZyLwKy3w== Date: Tue, 31 Oct 2023 10:53:30 +0100 From: Paul Kocialkowski To: Christophe JAILLET Cc: Mehdi Djait , mchehab@kernel.org, heiko@sntech.de, hverkuil-cisco@xs4all.nl, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, conor+dt@kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com, maxime.chevallier@bootlin.com, michael.riesch@wolfvision.net Subject: Re: [PATCH v9 2/3] media: rockchip: Add a driver for Rockchip's camera interface Message-ID: References: <79231ec3-8da1-4c73-8f5b-efa445e6c35d@wanadoo.fr> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dYFHt+x1tKrOKW1+" Content-Disposition: inline In-Reply-To: <79231ec3-8da1-4c73-8f5b-efa445e6c35d@wanadoo.fr> X-GND-Sasl: paul.kocialkowski@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 02:54:54 -0700 (PDT) --dYFHt+x1tKrOKW1+ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue 31 Oct 23, 10:46, Christophe JAILLET wrote: > Le 31/10/2023 =C3=A0 10:33, Mehdi Djait a =C3=A9crit=C2=A0: > > Hello Christophe, > >=20 > > On Mon, Oct 30, 2023 at 01:47:17PM +0100, Christophe JAILLET wrote: > > > > + /* Create & register platform subdev. */ > > > > + ret =3D cif_register_stream_vdev(cif_dev); > > > > + if (ret < 0) > > > > + goto err_unreg_media_dev; > > > > + > > > > + ret =3D cif_subdev_notifier(cif_dev); > > > > + if (ret < 0) { > > > > + v4l2_err(&cif_dev->v4l2_dev, > > > > + "Failed to register subdev notifier(%d)\n", ret); > > > > + cif_unregister_stream_vdev(cif_dev); > > > > + goto err_unreg_media_dev; > > >=20 > > > Should there be another label with cif_unregister_stream_vdev(cif_dev= ); if > > > an error occurs here? > > >=20 > > > CJ > >=20 > > cif_subdev_notifier() is the last function call in the probe with error > > handling. So it will undo the last successful register: > > cif_register_stream_vdev and use the goto to unregister the rest. >=20 > Ah, I didn't see the cif_unregister_stream_vdev() call here. > Sorry for the noise. >=20 > >=20 > > I can add a label err_unreg_stream_vdev but it will be only used in the > > error handling of cif_subdev_notifier() and I don't see the benefit. >=20 > The main benefit is to be more consistent in the way the error path is > written, and to be more future proof. Indeed the fact that there is only a single user of the label is not a reas= on to avoid the label. As soon as you need to use labels/gotos for error handl= ing, you should do it for all steps involved and avoid mixing unregistration in = the error-checking condition and using a previous label. Cheers, Paul >=20 > CJ > >=20 > > -- > > Kind Regards > > Mehdi Djait > >=20 > > > > + } > > > > + > > > > + cif_set_default_format(cif_dev); > > > > + pm_runtime_enable(&pdev->dev); > > > > + > > > > + return 0; > > > > + > > > > +err_unreg_media_dev: > > > > + media_device_unregister(&cif_dev->media_dev); > > > > +err_unreg_v4l2_dev: > > > > + v4l2_device_unregister(&cif_dev->v4l2_dev); > > > > + return ret; > > > > +} > >=20 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --dYFHt+x1tKrOKW1+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmVAzpoACgkQ3cLmz3+f v9Hw3Af+I1RiSM4LM+oLdDR2amN3CH8ODW0RSGGF7ynMWEsTPk0rceP6WGxD96ie BnwJAudOqNLFhVdgTib8wfZnJqljpQG+0SeVpprlAHI7GooAZ0i3YywzfbrMhUnO rRuCvdpl3aLAJ4kx05AMm0myRhNr8J69DjtADmQmaWWhXka1cWm6ZCZQLuBzHcv3 29AzkE7jXcFPmtDsJO/DbGI6b5/tYBcoOPYSJjiOYD3EI/fcoINv8DGRQY66vVaL wbZpV72MdselOHkaGvnD1VCYVgvJ8ARfOSjpiwY6L59bM7+1aS4opnSEY3xf9nmS YiARdyCLIQs3aHbuFCQVyUAMzs2doQ== =/LT8 -----END PGP SIGNATURE----- --dYFHt+x1tKrOKW1+--