[edk2] [PATCH v3 05/16] ArmPlatformPkg: HDLCD and PL111: Update debug ASSERTS

Girish Pathak posted 16 patches 7 years, 10 months ago
There is a newer version of this series
[edk2] [PATCH v3 05/16] ArmPlatformPkg: HDLCD and PL111: Update debug ASSERTS
Posted by Girish Pathak 7 years, 10 months ago
From: Girish Pathak <girish.pathak at arm.com>

This change moves some ASSERTs in error handling code
to improve efficiency in DEBUG build. This change also
removes redundant error code returns.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
---

Notes:
    v3:
    - Reverted to ASSERT_EFI_ERROR (Status) from ASSERT (FALSE)

 ArmPlatformPkg/Library/HdLcd/HdLcd.c       | 11 +++++------
 ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 12 ++++++------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c
index be4ccfdc1f421060faec792c8e8acfcfb3232014..28306c530e08b5e0fcef4308435045da3c9e093c 100644
--- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c
+++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c
@@ -90,8 +90,7 @@ LcdInitialize (
   @param[in] ModeNumber          Display mode number.
 
   @retval EFI_SUCCESS            Display mode set successfully.
-  @retval EFI_DEVICE_ERROR       Reurns an error if display timing
-                                 information is not available.
+  @retval !(EFI_SUCCESS)         Other errors.
 **/
 EFI_STATUS
 LcdSetMode (
@@ -122,15 +121,15 @@ LcdSetMode (
              &VBackPorch,
              &VFrontPorch
              );
-  ASSERT_EFI_ERROR (Status);
   if (EFI_ERROR (Status)) {
-    return EFI_DEVICE_ERROR;
+    ASSERT_EFI_ERROR (Status);
+    return Status;
   }
 
   Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);
-  ASSERT_EFI_ERROR (Status);
   if (EFI_ERROR (Status)) {
-    return EFI_DEVICE_ERROR;
+    ASSERT_EFI_ERROR (Status);
+    return Status;
   }
 
   BytesPerPixel = GetBytesPerPixel (LcdBpp);
diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
index ccd7a4d1d43ad5c2f495683ac68236e17f3b55a5..cb64c57dd79f3bb1345e4d3dbda7f5b3ce859f40 100644
--- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
+++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
@@ -75,8 +75,8 @@ LcdInitialize (
   @param[in] ModeNumbe           Display mode number.
 
   @retval EFI_SUCCESS            Display mode set successfuly.
-  @retval EFI_DEVICE_ERROR       It returns an error if display timing
-                                 information is not available.
+  @retval !(EFI_SUCCESS)         Other errors.
+
 **/
 EFI_STATUS
 LcdSetMode (
@@ -107,15 +107,15 @@ LcdSetMode (
              &VBackPorch,
              &VFrontPorch
              );
-  ASSERT_EFI_ERROR (Status);
   if (EFI_ERROR (Status)) {
-    return EFI_DEVICE_ERROR;
+    ASSERT_EFI_ERROR (Status);
+    return Status;
   }
 
   Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);
-  ASSERT_EFI_ERROR (Status);
   if (EFI_ERROR (Status)) {
-    return EFI_DEVICE_ERROR;
+    ASSERT_EFI_ERROR (Status);
+    return Status;
   }
 
   // Disable the CLCD_LcdEn bit
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3 05/16] ArmPlatformPkg: HDLCD and PL111: Update debug ASSERTS
Posted by Evan Lloyd 7 years, 10 months ago
Reviewed-by: Evan Lloyd <evan.lloyd@arm.com>

> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Girish
> Pathak
> Sent: 20 March 2018 16:12
> To: edk2-devel@lists.01.org
> Cc: nd <nd@arm.com>; Stephanie Hughes-Fitt <Stephanie.Hughes-
> Fitt@arm.com>; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org
> Subject: [edk2] [PATCH v3 05/16] ArmPlatformPkg: HDLCD and PL111:
> Update debug ASSERTS
> 
> From: Girish Pathak <girish.pathak at arm.com>
> 
> This change moves some ASSERTs in error handling code to improve
> efficiency in DEBUG build. This change also removes redundant error code
> returns.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Girish Pathak <girish.pathak@arm.com>
> Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
> ---
> 
> Notes:
>     v3:
>     - Reverted to ASSERT_EFI_ERROR (Status) from ASSERT (FALSE)
> 
>  ArmPlatformPkg/Library/HdLcd/HdLcd.c       | 11 +++++------
>  ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 12 ++++++------
>  2 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c
> b/ArmPlatformPkg/Library/HdLcd/HdLcd.c
> index
> be4ccfdc1f421060faec792c8e8acfcfb3232014..28306c530e08b5e0fcef430
> 8435045da3c9e093c 100644
> --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c
> +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c
> @@ -90,8 +90,7 @@ LcdInitialize (
>    @param[in] ModeNumber          Display mode number.
> 
>    @retval EFI_SUCCESS            Display mode set successfully.
> -  @retval EFI_DEVICE_ERROR       Reurns an error if display timing
> -                                 information is not available.
> +  @retval !(EFI_SUCCESS)         Other errors.
>  **/
>  EFI_STATUS
>  LcdSetMode (
> @@ -122,15 +121,15 @@ LcdSetMode (
>               &VBackPorch,
>               &VFrontPorch
>               );
> -  ASSERT_EFI_ERROR (Status);
>    if (EFI_ERROR (Status)) {
> -    return EFI_DEVICE_ERROR;
> +    ASSERT_EFI_ERROR (Status);
> +    return Status;
>    }
> 
>    Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);
> -  ASSERT_EFI_ERROR (Status);
>    if (EFI_ERROR (Status)) {
> -    return EFI_DEVICE_ERROR;
> +    ASSERT_EFI_ERROR (Status);
> +    return Status;
>    }
> 
>    BytesPerPixel = GetBytesPerPixel (LcdBpp); diff --git
> a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
> b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
> index
> ccd7a4d1d43ad5c2f495683ac68236e17f3b55a5..cb64c57dd79f3bb1345e4
> d3dbda7f5b3ce859f40 100644
> --- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
> +++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
> @@ -75,8 +75,8 @@ LcdInitialize (
>    @param[in] ModeNumbe           Display mode number.
> 
>    @retval EFI_SUCCESS            Display mode set successfuly.
> -  @retval EFI_DEVICE_ERROR       It returns an error if display timing
> -                                 information is not available.
> +  @retval !(EFI_SUCCESS)         Other errors.
> +
>  **/
>  EFI_STATUS
>  LcdSetMode (
> @@ -107,15 +107,15 @@ LcdSetMode (
>               &VBackPorch,
>               &VFrontPorch
>               );
> -  ASSERT_EFI_ERROR (Status);
>    if (EFI_ERROR (Status)) {
> -    return EFI_DEVICE_ERROR;
> +    ASSERT_EFI_ERROR (Status);
> +    return Status;
>    }
> 
>    Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);
> -  ASSERT_EFI_ERROR (Status);
>    if (EFI_ERROR (Status)) {
> -    return EFI_DEVICE_ERROR;
> +    ASSERT_EFI_ERROR (Status);
> +    return Status;
>    }
> 
>    // Disable the CLCD_LcdEn bit
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel