diff mbox series

drm/msm: remove unneeded variable ret

Message ID 20210407130654.3387-1-bernard@vivo.com (mailing list archive)
State New, archived
Headers show
Series drm/msm: remove unneeded variable ret | expand

Commit Message

Bernard Zhao April 7, 2021, 1:06 p.m. UTC
This patch fix coccicheck warning:
drivers/gpu/drm/msm/dp/dp_link.c:848:5-8: Unneeded variable: "ret". Return "0" on line 880
Also remove unneeded function return value check.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/msm/dp/dp_link.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Comments

Abhinav Kumar April 7, 2021, 5:55 p.m. UTC | #1
On 2021-04-07 06:06, Bernard Zhao wrote:
> This patch fix coccicheck warning:
> drivers/gpu/drm/msm/dp/dp_link.c:848:5-8: Unneeded variable: "ret".
> Return "0" on line 880
> Also remove unneeded function return value check.
> 
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/dp/dp_link.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_link.c 
> b/drivers/gpu/drm/msm/dp/dp_link.c
> index be986da78c4a..3395b08155a6 100644
> --- a/drivers/gpu/drm/msm/dp/dp_link.c
> +++ b/drivers/gpu/drm/msm/dp/dp_link.c
> @@ -843,10 +843,8 @@ bool dp_link_send_edid_checksum(struct dp_link
> *dp_link, u8 checksum)
>  	return ret == 1;
>  }
> 
> -static int dp_link_parse_vx_px(struct dp_link_private *link)
> +static void dp_link_parse_vx_px(struct dp_link_private *link)
>  {
> -	int ret = 0;
> -
>  	DRM_DEBUG_DP("vx: 0=%d, 1=%d, 2=%d, 3=%d\n",
>  		drm_dp_get_adjust_request_voltage(link->link_status, 0),
>  		drm_dp_get_adjust_request_voltage(link->link_status, 1),
> @@ -876,8 +874,6 @@ static int dp_link_parse_vx_px(struct 
> dp_link_private *link)
>  	DRM_DEBUG_DP("Requested: v_level = 0x%x, p_level = 0x%x\n",
>  			link->dp_link.phy_params.v_level,
>  			link->dp_link.phy_params.p_level);
> -
> -	return ret;
>  }
> 
>  /**
> @@ -891,8 +887,6 @@ static int dp_link_parse_vx_px(struct 
> dp_link_private *link)
>  static int dp_link_process_phy_test_pattern_request(
>  		struct dp_link_private *link)
>  {
> -	int ret = 0;
> -
>  	if (!(link->request.test_requested & DP_TEST_LINK_PHY_TEST_PATTERN)) 
> {
>  		DRM_DEBUG_DP("no phy test\n");
>  		return -EINVAL;
> @@ -918,12 +912,9 @@ static int 
> dp_link_process_phy_test_pattern_request(
>  	link->dp_link.link_params.rate =
>  		drm_dp_bw_code_to_link_rate(link->request.test_link_rate);
> 
> -	ret = dp_link_parse_vx_px(link);
> -
> -	if (ret)
> -		DRM_ERROR("parse_vx_px failed. ret=%d\n", ret);
> +	dp_link_parse_vx_px(link);
> 
> -	return ret;
> +	return 0;
>  }
> 
>  static u8 get_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], 
> int r)
Stephen Boyd April 7, 2021, 6:22 p.m. UTC | #2
Quoting Bernard Zhao (2021-04-07 06:06:21)
> This patch fix coccicheck warning:
> drivers/gpu/drm/msm/dp/dp_link.c:848:5-8: Unneeded variable: "ret". Return "0" on line 880
> Also remove unneeded function return value check.
> 
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Dmitry Baryshkov May 26, 2021, 12:55 a.m. UTC | #3
On 07/04/2021 16:06, Bernard Zhao wrote:
> This patch fix coccicheck warning:
> drivers/gpu/drm/msm/dp/dp_link.c:848:5-8: Unneeded variable: "ret". Return "0" on line 880
> Also remove unneeded function return value check.
> 
> Signed-off-by: Bernard Zhao <bernard@vivo.com>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


> ---
>   drivers/gpu/drm/msm/dp/dp_link.c | 15 +++------------
>   1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c
> index be986da78c4a..3395b08155a6 100644
> --- a/drivers/gpu/drm/msm/dp/dp_link.c
> +++ b/drivers/gpu/drm/msm/dp/dp_link.c
> @@ -843,10 +843,8 @@ bool dp_link_send_edid_checksum(struct dp_link *dp_link, u8 checksum)
>   	return ret == 1;
>   }
>   
> -static int dp_link_parse_vx_px(struct dp_link_private *link)
> +static void dp_link_parse_vx_px(struct dp_link_private *link)
>   {
> -	int ret = 0;
> -
>   	DRM_DEBUG_DP("vx: 0=%d, 1=%d, 2=%d, 3=%d\n",
>   		drm_dp_get_adjust_request_voltage(link->link_status, 0),
>   		drm_dp_get_adjust_request_voltage(link->link_status, 1),
> @@ -876,8 +874,6 @@ static int dp_link_parse_vx_px(struct dp_link_private *link)
>   	DRM_DEBUG_DP("Requested: v_level = 0x%x, p_level = 0x%x\n",
>   			link->dp_link.phy_params.v_level,
>   			link->dp_link.phy_params.p_level);
> -
> -	return ret;
>   }
>   
>   /**
> @@ -891,8 +887,6 @@ static int dp_link_parse_vx_px(struct dp_link_private *link)
>   static int dp_link_process_phy_test_pattern_request(
>   		struct dp_link_private *link)
>   {
> -	int ret = 0;
> -
>   	if (!(link->request.test_requested & DP_TEST_LINK_PHY_TEST_PATTERN)) {
>   		DRM_DEBUG_DP("no phy test\n");
>   		return -EINVAL;
> @@ -918,12 +912,9 @@ static int dp_link_process_phy_test_pattern_request(
>   	link->dp_link.link_params.rate =
>   		drm_dp_bw_code_to_link_rate(link->request.test_link_rate);
>   
> -	ret = dp_link_parse_vx_px(link);
> -
> -	if (ret)
> -		DRM_ERROR("parse_vx_px failed. ret=%d\n", ret);
> +	dp_link_parse_vx_px(link);
>   
> -	return ret;
> +	return 0;
>   }
>   
>   static u8 get_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], int r)
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c
index be986da78c4a..3395b08155a6 100644
--- a/drivers/gpu/drm/msm/dp/dp_link.c
+++ b/drivers/gpu/drm/msm/dp/dp_link.c
@@ -843,10 +843,8 @@  bool dp_link_send_edid_checksum(struct dp_link *dp_link, u8 checksum)
 	return ret == 1;
 }
 
-static int dp_link_parse_vx_px(struct dp_link_private *link)
+static void dp_link_parse_vx_px(struct dp_link_private *link)
 {
-	int ret = 0;
-
 	DRM_DEBUG_DP("vx: 0=%d, 1=%d, 2=%d, 3=%d\n",
 		drm_dp_get_adjust_request_voltage(link->link_status, 0),
 		drm_dp_get_adjust_request_voltage(link->link_status, 1),
@@ -876,8 +874,6 @@  static int dp_link_parse_vx_px(struct dp_link_private *link)
 	DRM_DEBUG_DP("Requested: v_level = 0x%x, p_level = 0x%x\n",
 			link->dp_link.phy_params.v_level,
 			link->dp_link.phy_params.p_level);
-
-	return ret;
 }
 
 /**
@@ -891,8 +887,6 @@  static int dp_link_parse_vx_px(struct dp_link_private *link)
 static int dp_link_process_phy_test_pattern_request(
 		struct dp_link_private *link)
 {
-	int ret = 0;
-
 	if (!(link->request.test_requested & DP_TEST_LINK_PHY_TEST_PATTERN)) {
 		DRM_DEBUG_DP("no phy test\n");
 		return -EINVAL;
@@ -918,12 +912,9 @@  static int dp_link_process_phy_test_pattern_request(
 	link->dp_link.link_params.rate =
 		drm_dp_bw_code_to_link_rate(link->request.test_link_rate);
 
-	ret = dp_link_parse_vx_px(link);
-
-	if (ret)
-		DRM_ERROR("parse_vx_px failed. ret=%d\n", ret);
+	dp_link_parse_vx_px(link);
 
-	return ret;
+	return 0;
 }
 
 static u8 get_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], int r)