From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=fan.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 71294222A54F4 for ; Wed, 3 Jan 2018 19:15:56 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jan 2018 19:20:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,505,1508828400"; d="scan'208";a="21245835" Received: from fanwang2-hp.ccr.corp.intel.com ([10.239.9.33]) by orsmga001.jf.intel.com with ESMTP; 03 Jan 2018 19:20:27 -0800 From: fanwang2 To: edk2-devel@lists.01.org Cc: Wang Fan , Ye Ting , Jiaxin Wu , Fu Siyuan Date: Thu, 4 Jan 2018 11:20:07 +0800 Message-Id: <1515036008-10700-4-git-send-email-fan.wang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1515036008-10700-1-git-send-email-fan.wang@intel.com> References: <1515036008-10700-1-git-send-email-fan.wang@intel.com> Subject: [Patch 3/4] NetworkPkg: Fix some coding style issues in UDP6 driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jan 2018 03:15:57 -0000 From: Wang Fan In UDP6Dxe, there are some coding style issues, this patch is to fix these issues. Cc: Ye Ting Cc: Jiaxin Wu Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan --- 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.
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
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