lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2235027.ElGaqSPkdT@jernej-laptop>
Date:   Wed, 27 Apr 2022 20:40:18 +0200
From:   Jernej Škrabec <jernej.skrabec@...il.com>
To:     linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
        Paul Kocialkowski <paul.kocialkowski@...tlin.com>
Cc:     Yong Deng <yong.deng@...ewell.com>,
        Paul Kocialkowski <paul.kocialkowski@...tlin.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Chen-Yu Tsai <wens@...e.org>,
        Samuel Holland <samuel@...lland.org>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Maxime Ripard <mripard@...nel.org>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v4 11/45] media: sun6i-csi: Register the media device after creation

Dne petek, 15. april 2022 ob 17:27:37 CEST je Paul Kocialkowski napisal(a):
> There is no particular need to register the media device in the
> subdev notify complete callback.
> 
> Register it in the v4l2 code instead where it's more in-context.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@...tlin.com>

Ideally, error path could use new label, but since media_device_unregister() 
check for if it was registered, this works too.

Acked-by: Jernej Skrabec <jernej.skrabec@...il.com>

Best regards,
Jernej

> ---
>  drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
> b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index
> 198275e09865..e59ee3e3f372 100644
> --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
> +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
> @@ -638,7 +638,7 @@ static int sun6i_subdev_notify_complete(struct
> v4l2_async_notifier *notifier) if (ret < 0)
>  		return ret;
> 
> -	return media_device_register(&v4l2->media_dev);
> +	return 0;
>  }
> 
>  static const struct v4l2_async_notifier_operations sun6i_csi_async_ops = {
> @@ -687,6 +687,12 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device
> *csi_dev)
> 
>  	media_device_init(media_dev);
> 
> +	ret = media_device_register(media_dev);
> +	if (ret) {
> +		dev_err(dev, "failed to register media device: %d\n", 
ret);
> +		goto error_media;
> +	}
> +
>  	/* V4L2 Control Handler */
> 
>  	ret = v4l2_ctrl_handler_init(&v4l2->ctrl_handler, 0);
> @@ -746,6 +752,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device
> *csi_dev) v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
> 
>  error_media:
> +	media_device_unregister(media_dev);
>  	media_device_cleanup(media_dev);
> 
>  	return ret;




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ