diff mbox series

[v3,4/5] EDAC/qcom: Remove extra error no assignment in qcom_llcc_core_setup()

Message ID 20220825043859.30066-5-manivannan.sadhasivam@linaro.org (mailing list archive)
State New, archived
Headers show
Series Fix crash when using Qcom LLCC/EDAC drivers | expand

Commit Message

Manivannan Sadhasivam Aug. 25, 2022, 4:38 a.m. UTC
If the ret variable is initialized with -EINVAL, then there is no need to
assign it again in the default case of qcom_llcc_core_setup().

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/edac/qcom_edac.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Sai Prakash Ranjan Aug. 25, 2022, 4:45 a.m. UTC | #1
On 8/25/2022 10:08 AM, Manivannan Sadhasivam wrote:
> If the ret variable is initialized with -EINVAL, then there is no need to
> assign it again in the default case of qcom_llcc_core_setup().

Nit: I think you meant in qcom_llcc_clear_error_status().

>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>   drivers/edac/qcom_edac.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>

> diff --git a/drivers/edac/qcom_edac.c b/drivers/edac/qcom_edac.c
> index 04df70b7fea3..0b6ca1f20b51 100644
> --- a/drivers/edac/qcom_edac.c
> +++ b/drivers/edac/qcom_edac.c
> @@ -126,7 +126,7 @@ static int qcom_llcc_core_setup(struct llcc_drv_data *drv, struct regmap *llcc_b
>   static int
>   qcom_llcc_clear_error_status(int err_type, struct llcc_drv_data *drv)
>   {
> -	int ret = 0;
> +	int ret = -EINVAL;
>   
>   	switch (err_type) {
>   	case LLCC_DRAM_CE:
> @@ -158,7 +158,6 @@ qcom_llcc_clear_error_status(int err_type, struct llcc_drv_data *drv)
>   			return ret;
>   		break;
>   	default:
> -		ret = -EINVAL;
>   		edac_printk(KERN_CRIT, EDAC_LLCC, "Unexpected error type: %d\n",
>   			    err_type);
>   	}
diff mbox series

Patch

diff --git a/drivers/edac/qcom_edac.c b/drivers/edac/qcom_edac.c
index 04df70b7fea3..0b6ca1f20b51 100644
--- a/drivers/edac/qcom_edac.c
+++ b/drivers/edac/qcom_edac.c
@@ -126,7 +126,7 @@  static int qcom_llcc_core_setup(struct llcc_drv_data *drv, struct regmap *llcc_b
 static int
 qcom_llcc_clear_error_status(int err_type, struct llcc_drv_data *drv)
 {
-	int ret = 0;
+	int ret = -EINVAL;
 
 	switch (err_type) {
 	case LLCC_DRAM_CE:
@@ -158,7 +158,6 @@  qcom_llcc_clear_error_status(int err_type, struct llcc_drv_data *drv)
 			return ret;
 		break;
 	default:
-		ret = -EINVAL;
 		edac_printk(KERN_CRIT, EDAC_LLCC, "Unexpected error type: %d\n",
 			    err_type);
 	}