lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.16 0559/1039] media: atomisp: check before deference asd variable
    Date
    From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

    [ Upstream commit 71665d816214124d6bc4eb80314ac8f84ecacd78 ]

    The asd->isp was referenced before checking if asd is not
    NULL.

    This fixes this warning:

    ../drivers/staging/media/atomisp/pci/atomisp_cmd.c:5548 atomisp_set_fmt_to_snr() warn: variable dereferenced before check 'asd' (see line 5540)

    While here, avoid getting the pipe pointer twice.

    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/staging/media/atomisp/pci/atomisp_cmd.c | 6 ++++--
    1 file changed, 4 insertions(+), 2 deletions(-)

    diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
    index 75a531667d743..1ddb9c815a3cb 100644
    --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
    +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
    @@ -5529,8 +5529,8 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev,
    unsigned int padding_w, unsigned int padding_h,
    unsigned int dvs_env_w, unsigned int dvs_env_h)
    {
    - struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
    struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
    + struct atomisp_sub_device *asd = pipe->asd;
    const struct atomisp_format_bridge *format;
    struct v4l2_subdev_pad_config pad_cfg;
    struct v4l2_subdev_state pad_state = {
    @@ -5541,7 +5541,7 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev,
    };
    struct v4l2_mbus_framefmt *ffmt = &vformat.format;
    struct v4l2_mbus_framefmt *req_ffmt;
    - struct atomisp_device *isp = asd->isp;
    + struct atomisp_device *isp;
    struct atomisp_input_stream_info *stream_info =
    (struct atomisp_input_stream_info *)ffmt->reserved;
    u16 stream_index = ATOMISP_INPUT_STREAM_GENERAL;
    @@ -5555,6 +5555,8 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev,
    return -EINVAL;
    }

    + isp = asd->isp;
    +
    v4l2_fh_init(&fh.vfh, vdev);

    stream_index = atomisp_source_pad_to_stream_id(asd, source_pad);
    --
    2.34.1


    \
     
     \ /
      Last update: 2022-01-24 23:10    [W:3.208 / U:1.128 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site