From: fanwang2 <fan.wang@intel.com>
To: edk2-devel@lists.01.org
Cc: Wang Fan <fan.wang@intel.com>, Ye Ting <ting.ye@intel.com>,
Jiaxin Wu <jiaxin.wu@intel.com>, Fu Siyuan <siyuan.fu@intel.com>
Subject: [Patch 3/4] NetworkPkg: Fix some coding style issues in UDP6 driver
Date: Thu, 4 Jan 2018 11:20:07 +0800 [thread overview]
Message-ID: <1515036008-10700-4-git-send-email-fan.wang@intel.com> (raw)
In-Reply-To: <1515036008-10700-1-git-send-email-fan.wang@intel.com>
From: Wang Fan <fan.wang@intel.com>
In UDP6Dxe, there are some coding style issues, this patch
is to fix these issues.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
NetworkPkg/Udp6Dxe/Udp6Driver.c | 20 ++++++++++----------
NetworkPkg/Udp6Dxe/Udp6Impl.c | 10 ++++++----
NetworkPkg/Udp6Dxe/Udp6Main.c | 2 +-
3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/NetworkPkg/Udp6Dxe/Udp6Driver.c b/NetworkPkg/Udp6Dxe/Udp6Driver.c
index a4b1104..6dde1fc 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Driver.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Driver.c
@@ -1,9 +1,9 @@
/** @file
Driver Binding functions and Service Binding functions for the Network driver module.
- Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
@@ -162,11 +162,10 @@ Udp6DriverBindingStart (
&Udp6Service->ServiceBinding,
NULL
);
if (EFI_ERROR (Status)) {
Udp6CleanService (Udp6Service);
- goto EXIT;
}
EXIT:
if (EFI_ERROR (Status)) {
if (Udp6Service != NULL) {
@@ -180,12 +179,13 @@ EXIT:
Callback function which provided by user to remove one node in NetDestroyLinkList process.
@param[in] Entry The entry to be removed.
@param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.
- @retval EFI_SUCCESS The entry has been removed successfully.
- @retval Others Fail to remove the entry.
+ @retval EFI_INVALID_PARAMETER Entry is NULL or Context is NULL.
+ @retval EFI_SUCCESS The entry has been removed successfully.
+ @retval Others Fail to remove the entry.
**/
EFI_STATUS
EFIAPI
Udp6DestroyChildEntryInHandleBuffer (
@@ -241,16 +241,16 @@ Udp6DriverBindingStop (
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_HANDLE NicHandle;
- EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
- UDP6_SERVICE_DATA *Udp6Service;
- LIST_ENTRY *List;
- UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
+ EFI_STATUS Status;
+ EFI_HANDLE NicHandle;
+ EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
+ UDP6_SERVICE_DATA *Udp6Service;
+ LIST_ENTRY *List;
+ UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
//
// Find the NicHandle where UDP6 ServiceBinding Protocol is installed.
//
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp6ProtocolGuid);
diff --git a/NetworkPkg/Udp6Dxe/Udp6Impl.c b/NetworkPkg/Udp6Dxe/Udp6Impl.c
index 25d4e6a..458470c 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Impl.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Impl.c
@@ -156,11 +156,12 @@ Udp6RecycleRxDataWrap (
@param[in] Packet Pointer to the buffer containing the received
datagram.
@param[in] RxData Pointer to the EFI_UDP6_RECEIVE_DATA of this
datagram.
- @return Pointer to the structure wrapping the RxData and the Packet.
+ @return Pointer to the structure wrapping the RxData and the Packet. NULL will
+ be returned if any error occurs.
**/
UDP6_RXDATA_WRAP *
Udp6WrapRxData (
IN UDP6_INSTANCE_DATA *Instance,
@@ -1372,11 +1373,12 @@ Udp6RecycleRxDataWrap (
@param[in] Packet Pointer to the buffer containing the received
datagram.
@param[in] RxData Pointer to the EFI_UDP6_RECEIVE_DATA of this
datagram.
- @return Pointer to the structure wrapping the RxData and the Packet.
+ @return Pointer to the structure wrapping the RxData and the Packet. NULL will
+ be returned if any error occurs.
**/
UDP6_RXDATA_WRAP *
Udp6WrapRxData (
IN UDP6_INSTANCE_DATA *Instance,
@@ -1596,11 +1598,11 @@ Udp6Demultiplex (
UINT16 HeadSum;
EFI_UDP6_RECEIVE_DATA RxData;
EFI_UDP6_SESSION_DATA *Udp6Session;
UINTN Enqueued;
- if (Packet->TotalSize < sizeof (EFI_UDP_HEADER)) {
+ if (Packet->TotalSize < UDP6_HEADER_SIZE) {
NetbufFree (Packet);
return;
}
//
@@ -1848,11 +1850,11 @@ Udp6IcmpHandler (
EFI_UDP_HEADER *Udp6Header;
EFI_UDP6_SESSION_DATA Udp6Session;
LIST_ENTRY *Entry;
UDP6_INSTANCE_DATA *Instance;
- if (Packet->TotalSize < sizeof (EFI_UDP_HEADER)) {
+ if (Packet->TotalSize < UDP6_HEADER_SIZE) {
NetbufFree (Packet);
return;
}
Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
diff --git a/NetworkPkg/Udp6Dxe/Udp6Main.c b/NetworkPkg/Udp6Dxe/Udp6Main.c
index 8495bc3..53145c3 100644
--- a/NetworkPkg/Udp6Dxe/Udp6Main.c
+++ b/NetworkPkg/Udp6Dxe/Udp6Main.c
@@ -583,11 +583,11 @@ Udp6Transmit (
Udp6Header->Checksum = Udp6Checksum (Packet, HeadSum);
if (Udp6Header->Checksum == 0) {
//
// If the calculated checksum is 0, fill the Checksum field with all ones.
//
- Udp6Header->Checksum = 0XFFFF;
+ Udp6Header->Checksum = 0xffff;
}
} else {
//
// Set the checksum is zero if the ConfigData->StationAddress is unspcified
// and the Ipv6 will fill the correct value of this checksum.
--
1.9.5.msysgit.1
next prev parent reply other threads:[~2018-01-04 3:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 3:20 [Patch 0/4] Fix some issues in Udp6Dxe fanwang2
2018-01-04 3:20 ` [Patch 1/4] NetworkPkg: Add ASSERT error handling for UDP6 driver fanwang2
2018-01-04 3:20 ` [Patch 2/4] NetworkPkg: Fix a memory leak issue in " fanwang2
2018-01-04 3:20 ` fanwang2 [this message]
2018-01-04 3:20 ` [Patch 4/4] NetworkPkg: Add more parameter or return status check " fanwang2
2018-01-11 5:37 ` [Patch 0/4] Fix some issues in Udp6Dxe Wu, Jiaxin
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=1515036008-10700-4-git-send-email-fan.wang@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