NULL pointer dereference in imx-mipi-csis driver when starting stream

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Feb 15 04:05:29 PST 2023


On Wed, Feb 15, 2023 at 12:53:56PM +0100, Frieder Schrempf wrote:
> On 14.02.23 17:47, Frieder Schrempf wrote:
> > Hi everyone,
> > 
> > after solving the previous devicetree and driver issues with the media
> > pipeline on i.MX8MM using a RPi v2.1 camera module (imx219) as sensor, I
> > now try to get an image from the sensor and run into the next problem.
> > 
> > Below you can find the commands I use and the output I'm getting. Maybe
> > someone can see straight away what's wrong or at least can make a guess
> > before I start diving into the code. ;)
> > 
> > By the way: This happens on v6.1.11 and 6.2-rc8.
> 
> So it looks like there are several problems (again):
> 
> First I missed to enable the link between the imx219 and the imx-mipi-csis:
> 
> media-ctl -l "'imx219 1-0010':0 -> 'csis-32e30000.mipi-csi':0[1]"
> 
> And the imx-mipi-csis driver is missing a check for the missing source
> link which caused the exception. I currently have this applied and will
> send this as formal patch later:
> 
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -596,6 +596,11 @@ static int mipi_csis_calculate_params(struct
> mipi_csis_device *csis,
>         s64 link_freq;
>         u32 lane_rate;
> 
> +       if (!csis->src_sd) {
> +               dev_err(csis->dev, "Missing source link\n");
> +               return -EINVAL;
> +       }
> +
>         /* Calculate the line rate from the pixel rate. */
>         link_freq = v4l2_get_link_freq(csis->src_sd->ctrl_handler,
>                                        csis_fmt->width,

The pipeline is not correctly configured, and that should have been
caught earlier as both pads are created with the
MEDIA_PAD_FL_MUST_CONNECT flag. The __media_pipeline_start() function
should have return an error. Could you try to check why that didn't
happen ?

> Now with this resolved, I get:
> 
> v4l2-ctl -d /dev/video0
> --set-fmt-video=width=640,height=480,pixelformat=RG10 --stream-mmap
> [  574.758110] imx7-csi 32e20000.csi: pipeline start failed with -32
>                 VIDIOC_STREAMON returned -1 (Broken pipe)
> 
> So still not there, but a bit closer ;)
> Probably I'm doing something wrong when setting up the format, etc.

Quite likely :-) Have you configured formats on all subdevs through the
pipeline with media-ctl ?

-- 
Regards,

Laurent Pinchart



More information about the linux-arm-kernel mailing list