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.10 068/563] media: atomisp: do not use err var when checking port validity for ISP2400
    Date
    From: Tsuchiya Yuto <kitakar@gmail.com>

    [ Upstream commit 9f6b4fa2d2dfbff4b8a57eeb39b1128a6094ee20 ]

    Currently, the `port >= N_CSI_PORTS || err` checks for ISP2400 are always
    evaluated as true because the err variable is set to `-EINVAL` on
    declaration but the variable is never used until the evaluation.

    Looking at the diff of commit 3c0538fbad9f ("media: atomisp: get rid of
    most checks for ISP2401 version"), the `port >= N_CSI_PORTS` check is
    for ISP2400 and the err variable check is for ISP2401. Fix this issue
    by adding ISP version test there accordingly.

    Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version")
    Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/staging/media/atomisp/pci/sh_css_mipi.c | 9 ++++++---
    1 file changed, 6 insertions(+), 3 deletions(-)

    diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c
    index e18c0cfb4ce3a..34b71c1b7c1ec 100644
    --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c
    +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c
    @@ -446,7 +446,8 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,

    assert(port < N_CSI_PORTS);

    - if (port >= N_CSI_PORTS || err) {
    + if ((!IS_ISP2401 && port >= N_CSI_PORTS) ||
    + (IS_ISP2401 && err)) {
    ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
    "allocate_mipi_frames(%p) exit: error: port is not correct (port=%d).\n",
    pipe, port);
    @@ -578,7 +579,8 @@ free_mipi_frames(struct ia_css_pipe *pipe) {

    assert(port < N_CSI_PORTS);

    - if (port >= N_CSI_PORTS || err) {
    + if ((!IS_ISP2401 && port >= N_CSI_PORTS) ||
    + (IS_ISP2401 && err)) {
    ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
    "free_mipi_frames(%p, %d) exit: error: pipe port is not correct.\n",
    pipe, port);
    @@ -690,7 +692,8 @@ send_mipi_frames(struct ia_css_pipe *pipe) {

    assert(port < N_CSI_PORTS);

    - if (port >= N_CSI_PORTS || err) {
    + if ((!IS_ISP2401 && port >= N_CSI_PORTS) ||
    + (IS_ISP2401 && err)) {
    IA_CSS_ERROR("send_mipi_frames(%p) exit: invalid port specified (port=%d).\n",
    pipe, port);
    return err;
    --
    2.34.1


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