From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933335AbcIAPaq (ORCPT ); Thu, 1 Sep 2016 11:30:46 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:33189 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756112AbcIAPal (ORCPT ); Thu, 1 Sep 2016 11:30:41 -0400 Subject: Re: [Patch v3 08/11] net: ethernet: xilinx: Generate random mac if none found To: Sergei Shtylyov , , , , , References: <1472661352-11983-1-git-send-email-Zubair.Kakakhel@imgtec.com> <1472661352-11983-9-git-send-email-Zubair.Kakakhel@imgtec.com> <3e2dea83-ee59-2980-3a9d-50da04271158@cogentembedded.com> CC: , , , , From: Zubair Lutfullah Kakakhel Message-ID: Date: Thu, 1 Sep 2016 16:30:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <3e2dea83-ee59-2980-3a9d-50da04271158@cogentembedded.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [192.168.154.45] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/01/2016 11:52 AM, Sergei Shtylyov wrote: > Hello. > > On 8/31/2016 7:35 PM, Zubair Lutfullah Kakakhel wrote: > >> At the moment, if the emaclite device doesn't find a mac address >> from any source, it simply uses 0x0 with a warning printed. >> >> Instead of using a 0x0 mac address, use a randomly generated one. >> >> Signed-off-by: Zubair Lutfullah Kakakhel > [...] > >> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c >> index 3cee84a..22e5a5a 100644 >> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c >> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c >> @@ -1134,8 +1134,10 @@ static int xemaclite_of_probe(struct platform_device *ofdev) >> if (mac_address) >> /* Set the MAC address. */ >> memcpy(ndev->dev_addr, mac_address, ETH_ALEN); >> - else >> - dev_warn(dev, "No MAC address found\n"); >> + else { >> + dev_warn(dev, "No MAC address found. Generating Random one\n"); >> + eth_hw_addr_random(ndev); >> + } > > All branches of the *if* statement should have {} if at least one has them, see Documentation/CodingStyle, chaoter 3. Спасибо ZubairLK > > [...] > > MBR, Sergei >