From patchwork Sat Oct 25 15:19:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 5152171 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1B72FC11AC for ; Sat, 25 Oct 2014 19:21:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F82E20220 for ; Sat, 25 Oct 2014 19:21:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7907220165 for ; Sat, 25 Oct 2014 19:21:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752491AbaJYTVb (ORCPT ); Sat, 25 Oct 2014 15:21:31 -0400 Received: from static.88-198-24-112.clients.your-server.de ([88.198.24.112]:34744 "EHLO nbd.name" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752501AbaJYTVa (ORCPT ); Sat, 25 Oct 2014 15:21:30 -0400 Received: by nf.local (Postfix, from userid 501) id E3C3FA82052F; Sat, 25 Oct 2014 17:19:35 +0200 (CEST) From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: linville@tuxdriver.com, sujith@msujith.org Subject: [PATCH v2 10/10] ath9k: use a random MAC address if the EEPROM address is invalid Date: Sat, 25 Oct 2014 17:19:35 +0200 Message-Id: <1414250375-74121-10-git-send-email-nbd@openwrt.org> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1414250375-74121-1-git-send-email-nbd@openwrt.org> References: <1414250375-74121-1-git-send-email-nbd@openwrt.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DATE_IN_PAST_03_06, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Based on OpenWrt patch by Gabor Juhos Signed-off-by: Felix Fietkau --- drivers/net/wireless/ath/ath9k/hw.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 47f410e..ee9fb52 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "hw.h" @@ -446,8 +447,16 @@ static int ath9k_hw_init_macaddr(struct ath_hw *ah) common->macaddr[2 * i] = eeval >> 8; common->macaddr[2 * i + 1] = eeval & 0xff; } - if (sum == 0 || sum == 0xffff * 3) - return -EADDRNOTAVAIL; + if (!is_valid_ether_addr(common->macaddr)) { + ath_err(common, + "eeprom contains invalid mac address: %pM\n", + common->macaddr); + + random_ether_addr(common->macaddr); + ath_err(common, + "random mac address will be used: %pM\n", + common->macaddr); + } return 0; }