]> Git Repo - linux.git/commitdiff
soundwire: qcom: handle return correctly in qcom_swrm_transport_params
authorSrinivas Kandagatla <[email protected]>
Thu, 1 Apr 2021 09:15:02 +0000 (10:15 +0100)
committerVinod Koul <[email protected]>
Tue, 6 Apr 2021 04:55:26 +0000 (10:25 +0530)
Looks like return from reg_write is set but not checked.
Fix this by adding error return path.

Reported-by: coverity-bot <[email protected]>
Addresses-Coverity-ID: 1503591 ("UNUSED_VALUE")
Fixes: 128eaf937adb ("soundwire: qcom: add support to missing transport params")
Signed-off-by: Srinivas Kandagatla <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vinod Koul <[email protected]>
drivers/soundwire/qcom.c

index 892027e6df5f3d6d24a7d7de0d7c8a752d0e4e99..2827085a323b85078641c055019ea2346c89c203 100644 (file)
@@ -731,17 +731,23 @@ static int qcom_swrm_transport_params(struct sdw_bus *bus,
        value |= pcfg->si;
 
        ret = ctrl->reg_write(ctrl, reg, value);
+       if (ret)
+               goto err;
 
        if (pcfg->lane_control != SWR_INVALID_PARAM) {
                reg = SWRM_DP_PORT_CTRL_2_BANK(params->port_num, bank);
                value = pcfg->lane_control;
                ret = ctrl->reg_write(ctrl, reg, value);
+               if (ret)
+                       goto err;
        }
 
        if (pcfg->blk_group_count != SWR_INVALID_PARAM) {
                reg = SWRM_DP_BLOCK_CTRL2_BANK(params->port_num, bank);
                value = pcfg->blk_group_count;
                ret = ctrl->reg_write(ctrl, reg, value);
+               if (ret)
+                       goto err;
        }
 
        if (pcfg->hstart != SWR_INVALID_PARAM
@@ -755,11 +761,15 @@ static int qcom_swrm_transport_params(struct sdw_bus *bus,
                ret = ctrl->reg_write(ctrl, reg, value);
        }
 
+       if (ret)
+               goto err;
+
        if (pcfg->bp_mode != SWR_INVALID_PARAM) {
                reg = SWRM_DP_BLOCK_CTRL3_BANK(params->port_num, bank);
                ret = ctrl->reg_write(ctrl, reg, pcfg->bp_mode);
        }
 
+err:
        return ret;
 }
 
This page took 0.05843 seconds and 4 git commands to generate.