===================================================================
@@ -7604,31 +7604,33 @@ bool e1000_enable_tx_pkt_filtering(struc
{
/* called in init as well as watchdog timer functions */
- s32 ret_val, checksum;
- bool tx_filter = false;
+ s32 checksum;
+ bool tx_filter = true;
struct e1000_host_mng_dhcp_cookie *hdr = &(hw->mng_cookie);
u8 *buffer = (u8 *) &(hw->mng_cookie);
- if (e1000_check_mng_mode(hw)) {
- ret_val = e1000_mng_enable_host_if(hw);
- if (ret_val == E1000_SUCCESS) {
- ret_val = e1000_host_if_read_cookie(hw, buffer);
- if (ret_val == E1000_SUCCESS) {
- checksum = hdr->checksum;
- hdr->checksum = 0;
- if ((hdr->signature == E1000_IAMT_SIGNATURE) &&
- checksum == e1000_calculate_mng_checksum((char *)buffer,
- E1000_MNG_DHCP_COOKIE_LENGTH)) {
- if (hdr->status &
- E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT)
- tx_filter = true;
- } else
- tx_filter = true;
- } else
- tx_filter = true;
- }
- }
+ if (!e1000_check_mng_mode(hw))
+ goto out_false;
+
+ if (e1000_mng_enable_host_if(hw) != E1000_SUCCESS)
+ goto out_false;
+
+ if (e1000_host_if_read_cookie(hw, buffer) != E1000_SUCCESS)
+ goto out_true;
+ checksum = hdr->checksum;
+ hdr->checksum = 0;
+ if ((hdr->signature != E1000_IAMT_SIGNATURE) ||
+ checksum != e1000_calculate_mng_checksum((char *)buffer,
+ E1000_MNG_DHCP_COOKIE_LENGTH))
+ goto out_true;
+
+ if (hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT)
+ goto out_true;
+
+out_false:
+ tx_filter = false;
+out_true:
hw->tx_pkt_filtering = tx_filter;
return tx_filter;
}
This is purely cosmetic, but to my mind it makes the code a lot easier to follow. Signed-off-by: Simon Horman <horms@verge.net.au> --- Lightly tested. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html