* [PATCH] media: mali-c55: Fix NULL dev stream alert for tpg sub-device
@ 2026-01-13 7:57 jempty.liang
2026-01-13 8:55 ` Jacopo Mondi
0 siblings, 1 reply; 6+ messages in thread
From: jempty.liang @ 2026-01-13 7:57 UTC (permalink / raw)
To: dan.scally, jacopo.mondi, mchehab; +Cc: linux-media, linux-kernel, jempty.liang
Fix "(NULL device *): collect_streams: sub-device 'mali-c55 tpg'
does not support streams" by setting `sd->dev = mali_c55->dev`
for isp/resizer/tpg modules.
Signed-off-by: jempty.liang <imntjempty@163.com>
---
drivers/media/platform/arm/mali-c55/mali-c55-isp.c | 1 +
drivers/media/platform/arm/mali-c55/mali-c55-resizer.c | 1 +
drivers/media/platform/arm/mali-c55/mali-c55-tpg.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-isp.c b/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
index 497f25fbdd13..ce84aad9f1d5 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
@@ -610,6 +610,7 @@ int mali_c55_register_isp(struct mali_c55 *mali_c55)
sd->entity.ops = &mali_c55_isp_media_ops;
sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_ISP;
sd->internal_ops = &mali_c55_isp_internal_ops;
+ sd->dev = mali_c55->dev;
strscpy(sd->name, MALI_C55_DRIVER_NAME " isp", sizeof(sd->name));
isp->pads[MALI_C55_ISP_PAD_SINK_VIDEO].flags = MEDIA_PAD_FL_SINK |
diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c b/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c
index a8d739af74b6..c4f46651dcee 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c
@@ -1070,6 +1070,7 @@ static int mali_c55_register_resizer(struct mali_c55 *mali_c55,
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS;
sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER;
sd->internal_ops = &mali_c55_resizer_internal_ops;
+ sd->dev = mali_c55->dev;
rsz->pads[MALI_C55_RSZ_SINK_PAD].flags = MEDIA_PAD_FL_SINK;
rsz->pads[MALI_C55_RSZ_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE;
diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-tpg.c b/drivers/media/platform/arm/mali-c55/mali-c55-tpg.c
index 1af5d2759a83..894f4cf377af 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-tpg.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-tpg.c
@@ -370,6 +370,7 @@ int mali_c55_register_tpg(struct mali_c55 *mali_c55)
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
sd->internal_ops = &mali_c55_tpg_internal_ops;
+ sd->dev = mali_c55->dev;
strscpy(sd->name, MALI_C55_DRIVER_NAME " tpg", sizeof(sd->name));
pad->flags = MEDIA_PAD_FL_SOURCE;
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] media: mali-c55: Fix NULL dev stream alert for tpg sub-device
2026-01-13 7:57 [PATCH] media: mali-c55: Fix NULL dev stream alert for tpg sub-device jempty.liang
@ 2026-01-13 8:55 ` Jacopo Mondi
2026-01-13 10:40 ` Sakari Ailus
0 siblings, 1 reply; 6+ messages in thread
From: Jacopo Mondi @ 2026-01-13 8:55 UTC (permalink / raw)
To: jempty.liang, Laurent Pinchart, Sakari Ailus
Cc: dan.scally, jacopo.mondi, mchehab, linux-media, linux-kernel
Hi Jempty
On Tue, Jan 13, 2026 at 07:57:22AM +0000, jempty.liang wrote:
> Fix "(NULL device *): collect_streams: sub-device 'mali-c55 tpg'
> does not support streams" by setting `sd->dev = mali_c55->dev`
> for isp/resizer/tpg modules.
The missing device name in the error message is just a symptom, I
think this is a geniunely missing part of the subdevice initalization.
I would re-phrase this as
-------------------------------------------------------------------------------
The subdevices registered by the Mali-C55 driver do not have their
'struct device *dev' member initialized. This is visibile when looking
at debug message, as in example:
"(NULL device *): collect_streams: sub-device 'mali-c55 tpg' does not support streams"
Fix this by initializing the *dev field for each subdevice registered
by the Mali-C55 driver.
-------------------------------------------------------------------------------
I wonder if v4l2_device_register_subdev() shouldn't WARN or if return
an error if sd->dev is not initialized. Laurent, Sakari: opinions ?
Thanks
j
>
> Signed-off-by: jempty.liang <imntjempty@163.com>
> ---
> drivers/media/platform/arm/mali-c55/mali-c55-isp.c | 1 +
> drivers/media/platform/arm/mali-c55/mali-c55-resizer.c | 1 +
> drivers/media/platform/arm/mali-c55/mali-c55-tpg.c | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-isp.c b/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
> index 497f25fbdd13..ce84aad9f1d5 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-isp.c
> @@ -610,6 +610,7 @@ int mali_c55_register_isp(struct mali_c55 *mali_c55)
> sd->entity.ops = &mali_c55_isp_media_ops;
> sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_ISP;
> sd->internal_ops = &mali_c55_isp_internal_ops;
> + sd->dev = mali_c55->dev;
> strscpy(sd->name, MALI_C55_DRIVER_NAME " isp", sizeof(sd->name));
>
> isp->pads[MALI_C55_ISP_PAD_SINK_VIDEO].flags = MEDIA_PAD_FL_SINK |
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c b/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c
> index a8d739af74b6..c4f46651dcee 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-resizer.c
> @@ -1070,6 +1070,7 @@ static int mali_c55_register_resizer(struct mali_c55 *mali_c55,
> sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS;
> sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER;
> sd->internal_ops = &mali_c55_resizer_internal_ops;
> + sd->dev = mali_c55->dev;
>
> rsz->pads[MALI_C55_RSZ_SINK_PAD].flags = MEDIA_PAD_FL_SINK;
> rsz->pads[MALI_C55_RSZ_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE;
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-tpg.c b/drivers/media/platform/arm/mali-c55/mali-c55-tpg.c
> index 1af5d2759a83..894f4cf377af 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-tpg.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-tpg.c
> @@ -370,6 +370,7 @@ int mali_c55_register_tpg(struct mali_c55 *mali_c55)
> sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
> sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
> sd->internal_ops = &mali_c55_tpg_internal_ops;
> + sd->dev = mali_c55->dev;
> strscpy(sd->name, MALI_C55_DRIVER_NAME " tpg", sizeof(sd->name));
>
> pad->flags = MEDIA_PAD_FL_SOURCE;
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: mali-c55: Fix NULL dev stream alert for tpg sub-device
2026-01-13 8:55 ` Jacopo Mondi
@ 2026-01-13 10:40 ` Sakari Ailus
2026-01-13 12:43 ` Jacopo Mondi
2026-01-13 14:12 ` Dan Scally
0 siblings, 2 replies; 6+ messages in thread
From: Sakari Ailus @ 2026-01-13 10:40 UTC (permalink / raw)
To: Jacopo Mondi
Cc: jempty.liang, Laurent Pinchart, dan.scally, mchehab, linux-media,
linux-kernel
Hi Jacopo,
On Tue, Jan 13, 2026 at 09:55:10AM +0100, Jacopo Mondi wrote:
> I wonder if v4l2_device_register_subdev() shouldn't WARN or if return
> an error if sd->dev is not initialized. Laurent, Sakari: opinions ?
I might even return an error but I wonder what would break. Perhaps indeed
could start with a warning?
--
Sakari Ailus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: mali-c55: Fix NULL dev stream alert for tpg sub-device
2026-01-13 10:40 ` Sakari Ailus
@ 2026-01-13 12:43 ` Jacopo Mondi
2026-01-13 19:25 ` Sakari Ailus
2026-01-13 14:12 ` Dan Scally
1 sibling, 1 reply; 6+ messages in thread
From: Jacopo Mondi @ 2026-01-13 12:43 UTC (permalink / raw)
To: Sakari Ailus
Cc: Jacopo Mondi, jempty.liang, Laurent Pinchart, dan.scally, mchehab,
linux-media, linux-kernel
Hi Sakari
On Tue, Jan 13, 2026 at 12:40:25PM +0200, Sakari Ailus wrote:
> Hi Jacopo,
>
> On Tue, Jan 13, 2026 at 09:55:10AM +0100, Jacopo Mondi wrote:
> > I wonder if v4l2_device_register_subdev() shouldn't WARN or if return
> > an error if sd->dev is not initialized. Laurent, Sakari: opinions ?
>
> I might even return an error but I wonder what would break. Perhaps indeed
> could start with a warning?
I would start with:
--- a/drivers/media/v4l2-core/v4l2-device.c
+++ b/drivers/media/v4l2-core/v4l2-device.c
@@ -117,6 +117,13 @@ int __v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
if (!v4l2_dev || !sd || sd->v4l2_dev || !sd->name[0])
return -EINVAL;
+ /*
+ * Initializing sd->dev is mandatory. Warn for now to give faulty
+ * drivers a bit of time to update before actually returning an error.
+ */
+ WARN_ON(!sd->dev);
+
/*
* The reason to acquire the module here is to avoid unloading
* a module of sub-device which is registered to a media
Would you like a patch ?
>
> --
> Sakari Ailus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: mali-c55: Fix NULL dev stream alert for tpg sub-device
2026-01-13 10:40 ` Sakari Ailus
2026-01-13 12:43 ` Jacopo Mondi
@ 2026-01-13 14:12 ` Dan Scally
1 sibling, 0 replies; 6+ messages in thread
From: Dan Scally @ 2026-01-13 14:12 UTC (permalink / raw)
To: Sakari Ailus, Jacopo Mondi
Cc: jempty.liang, Laurent Pinchart, mchehab, linux-media,
linux-kernel
On 13/01/2026 10:40, Sakari Ailus wrote:
> Hi Jacopo,
>
> On Tue, Jan 13, 2026 at 09:55:10AM +0100, Jacopo Mondi wrote:
>> I wonder if v4l2_device_register_subdev() shouldn't WARN or if return
>> an error if sd->dev is not initialized. Laurent, Sakari: opinions ?
>
> I might even return an error but I wonder what would break. Perhaps indeed
> could start with a warning?
>
It looks like it's only used for dev_*() printks, unless I'm missing something. Thanks Jempty for
spotting the problem!
Dan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: mali-c55: Fix NULL dev stream alert for tpg sub-device
2026-01-13 12:43 ` Jacopo Mondi
@ 2026-01-13 19:25 ` Sakari Ailus
0 siblings, 0 replies; 6+ messages in thread
From: Sakari Ailus @ 2026-01-13 19:25 UTC (permalink / raw)
To: Jacopo Mondi
Cc: jempty.liang, Laurent Pinchart, dan.scally, mchehab, linux-media,
linux-kernel
Hi Jacopo,
On Tue, Jan 13, 2026 at 01:43:12PM +0100, Jacopo Mondi wrote:
> Hi Sakari
>
> On Tue, Jan 13, 2026 at 12:40:25PM +0200, Sakari Ailus wrote:
> > Hi Jacopo,
> >
> > On Tue, Jan 13, 2026 at 09:55:10AM +0100, Jacopo Mondi wrote:
> > > I wonder if v4l2_device_register_subdev() shouldn't WARN or if return
> > > an error if sd->dev is not initialized. Laurent, Sakari: opinions ?
> >
> > I might even return an error but I wonder what would break. Perhaps indeed
> > could start with a warning?
>
> I would start with:
>
> --- a/drivers/media/v4l2-core/v4l2-device.c
> +++ b/drivers/media/v4l2-core/v4l2-device.c
> @@ -117,6 +117,13 @@ int __v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
> if (!v4l2_dev || !sd || sd->v4l2_dev || !sd->name[0])
> return -EINVAL;
>
> + /*
> + * Initializing sd->dev is mandatory. Warn for now to give faulty
> + * drivers a bit of time to update before actually returning an error.
> + */
> + WARN_ON(!sd->dev);
> +
> /*
> * The reason to acquire the module here is to avoid unloading
> * a module of sub-device which is registered to a media
>
> Would you like a patch ?
Please. :-)
--
Kind regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-13 19:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13 7:57 [PATCH] media: mali-c55: Fix NULL dev stream alert for tpg sub-device jempty.liang
2026-01-13 8:55 ` Jacopo Mondi
2026-01-13 10:40 ` Sakari Ailus
2026-01-13 12:43 ` Jacopo Mondi
2026-01-13 19:25 ` Sakari Ailus
2026-01-13 14:12 ` Dan Scally
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox