public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] IntelSiliconPkg/PlatformVTdSample: Avoid using constant result 'if'
Date: Tue, 29 Aug 2017 12:12:45 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A9A3757@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20170829114411.20468-1-hao.a.wu@intel.com>

Reviewed-by: Jiewen.yao@Intel.com

> -----Original Message-----
> From: Wu, Hao A
> Sent: Tuesday, August 29, 2017 7:44 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] IntelSiliconPkg/PlatformVTdSample: Avoid using constant result
> 'if'
> 
> In this sample driver, if (0) {...} else {...} statements were used to
> illustrate two different using scenarios.
> 
> This comment refines the coding style by substituting the 'if (0)'
> statement with comments to select sample codes for different cases.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
>  .../PlatformVTdSampleDxe/PlatformVTdSampleDxe.c    | 38
> ++++++++++++++--------
>  1 file changed, 24 insertions(+), 14 deletions(-)
> 
> diff --git a/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c
> b/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c
> index 07499c7da8..3587fa3c83 100644
> --- a/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c
> +++ b/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c
> @@ -339,23 +339,33 @@ PlatformVTdGetExceptionDeviceList (
>      return EFI_INVALID_PARAMETER;
>    }
> 
> -  if (0) {
> -    *DeviceInfo = AllocateZeroPool (sizeof(mExceptionDeviceScopeList));
> -    if (*DeviceInfo == NULL) {
> -      return EFI_OUT_OF_RESOURCES;
> -    }
> -    CopyMem (*DeviceInfo, mExceptionDeviceScopeList,
> sizeof(mExceptionDeviceScopeList));
> +  //
> +  // Sample codes for device scope based exception list.
> +  // Uncomment to take affect and comment the sample codes for PCI vendor
> id
> +  // based exception list.
> +  //
> +  /*
> +  *DeviceInfo = AllocateZeroPool (sizeof(mExceptionDeviceScopeList));
> +  if (*DeviceInfo == NULL) {
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +  CopyMem (*DeviceInfo, mExceptionDeviceScopeList,
> sizeof(mExceptionDeviceScopeList));
> 
> -    *DeviceInfoCount = ARRAY_SIZE(mExceptionDeviceScopeList);
> -  } else {
> -    *DeviceInfo = AllocateZeroPool (sizeof(mExceptionPciDeviceIdList));
> -    if (*DeviceInfo == NULL) {
> -      return EFI_OUT_OF_RESOURCES;
> -    }
> -    CopyMem (*DeviceInfo, mExceptionPciDeviceIdList,
> sizeof(mExceptionPciDeviceIdList));
> +  *DeviceInfoCount = ARRAY_SIZE(mExceptionDeviceScopeList);
> +  */
> 
> -    *DeviceInfoCount = ARRAY_SIZE(mExceptionPciDeviceIdList);
> +  //
> +  // Sample codes for PCI vendor id based exception list.
> +  // Uncomment to take affect and comment the sample codes for device
> scope
> +  // based exception list.
> +  //
> +  *DeviceInfo = AllocateZeroPool (sizeof(mExceptionPciDeviceIdList));
> +  if (*DeviceInfo == NULL) {
> +    return EFI_OUT_OF_RESOURCES;
>    }
> +  CopyMem (*DeviceInfo, mExceptionPciDeviceIdList,
> sizeof(mExceptionPciDeviceIdList));
> +
> +  *DeviceInfoCount = ARRAY_SIZE(mExceptionPciDeviceIdList);
> 
>    return EFI_SUCCESS;
>  }
> --
> 2.12.0.windows.1



      reply	other threads:[~2017-08-29 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 11:44 [PATCH] IntelSiliconPkg/PlatformVTdSample: Avoid using constant result 'if' Hao Wu
2017-08-29 12:12 ` Yao, Jiewen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74D8A39837DF1E4DA445A8C0B3885C503A9A3757@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox