From patchwork Sun Sep 19 11:57:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 12504285 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9022FC433F5 for ; Sun, 19 Sep 2021 11:57:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E6B460ED7 for ; Sun, 19 Sep 2021 11:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231618AbhISL6z (ORCPT ); Sun, 19 Sep 2021 07:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230393AbhISL6y (ORCPT ); Sun, 19 Sep 2021 07:58:54 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2413DC061574 for ; Sun, 19 Sep 2021 04:57:29 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id d6so23418015wrc.11 for ; Sun, 19 Sep 2021 04:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8VCgDTfJ2SXMRPRIHoiGe2iWvCLro2JaYo28xKNRVY4=; b=OrK5+lue9hK8Eyrpn7zg9DvITX6VSW8X5bVP19Z7FVNzAdiNnyrX9cSzP2Kbz+PsAN u/SmZtfOuDgijrVal5s8UWgyQ9STeVFQgJrPLB+JE789JerkgTqwFWE0ApewF0EO/DqI pAxAL0QCqDizPMAFN8g3hrrDQVRCfTUp3eUhdNdAIvGZanouMrItwp8+zk6jy7qU5qkM FuDAJFUx94RRvmGDkAKJWqah1EAouUUUpYF/D5FvQIJntlyA88mq2l7neB6sntkr0tux mR6fIutS7yKM5YflD+obg3Fl7Y9puE/IWy4fmoZUbLEJ5/8+pMbpoNgmOVDt0KKeavT3 623w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8VCgDTfJ2SXMRPRIHoiGe2iWvCLro2JaYo28xKNRVY4=; b=YCzDbmZS3drmkdhSgSdzRNrh1WbKeguX40sHH5OFk/SnOF003CKuh4timn2r/4Ug5a hk/SiY/zIxpzmTtgQO6H6Fdrm0bh6TkRrwiFec74ZOSt6NrmqXBbe56+rBHIeb/iEhWR nlJi8VRYjvOuYzlF1FLIbyYh0knFE46XBtc/t4NU61lXVNgVo0jrkXYxwR1QDnvotGAw ipEmysbklQINTSrvNPai3B20KEZT70M4k0R+0avB024zqfaiydLN+w+wjbsUlTnTOEZ4 PkgpaGzgTvQHpS1/us04O0lXQRmJ0VTKRSAAzSXSZKsE/Z8ADBTUd5S2dJcRyT3v/T8y Dsgw== X-Gm-Message-State: AOAM533AOAHlD3d4ttIktTrQ2S4AA5aDFAtl3Ey/q0YrH/oos6pMFCiO oeL6KO3+ydCbYUU9zGfF9RaMiZlkAuM= X-Google-Smtp-Source: ABdhPJzTsxhL9crQEWI7arG2wl0yt8wzTusFcmI7xO8LpS5qvHTpkEiN3KRG9k44UirGZ1PprIe9bA== X-Received: by 2002:adf:80eb:: with SMTP id 98mr22614147wrl.348.1632052647687; Sun, 19 Sep 2021 04:57:27 -0700 (PDT) Received: from debian64.daheim (p200300d5ff2d4b00d63d7efffebde96e.dip0.t-ipconnect.de. [2003:d5:ff2d:4b00:d63d:7eff:febd:e96e]) by smtp.gmail.com with ESMTPSA id g13sm11309449wmh.20.2021.09.19.04.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Sep 2021 04:57:27 -0700 (PDT) Received: from chuck by debian64.daheim with local (Exim 4.95-RC2) (envelope-from ) id 1mRvRl-0007Z2-Dv; Sun, 19 Sep 2021 13:57:25 +0200 From: Christian Lamparter To: netdev@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com Cc: Andrew Lunn , Jakub Kicinski , "David S . Miller" , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , =?utf-8?q?Petr_=C5=A0t?= =?utf-8?q?etiar?= , Michael Walle Subject: [PATCH net v2] net: bgmac-bcma: handle deferred probe error due to mac-address Date: Sun, 19 Sep 2021 13:57:25 +0200 Message-Id: <20210919115725.29064-1-chunkeey@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Due to the inclusion of nvmem handling into the mac-address getter function of_get_mac_address() by commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") it is now possible to get a -EPROBE_DEFER return code. Which did cause bgmac to assign a random ethernet address. This exact issue happened on my Meraki MR32. The nvmem provider is an EEPROM (at24c64) which gets instantiated once the module driver is loaded... This happens once the filesystem becomes available. With this patch, bgmac_probe() will propagate the -EPROBE_DEFER error. Then the driver subsystem will reschedule the probe at a later time. Cc: Petr Štetiar Cc: Michael Walle Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") Signed-off-by: Christian Lamparter --- changes: v1 -> v2: rewrote commit message based on net (commit 02319bf15ac) [Andrew Lunn] "net" tag [Andrew Lunn] added "CCs" of the previous authors in that area --- drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ethernet/broadcom/bgmac-bcma.c index 85fa0ab7201c..9513cfb5ba58 100644 --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c @@ -129,6 +129,8 @@ static int bgmac_probe(struct bcma_device *core) bcma_set_drvdata(core, bgmac); err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr); + if (err == -EPROBE_DEFER) + return err; /* If no MAC address assigned via device tree, check SPROM */ if (err) {