From patchwork Mon Jun 29 12:03:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 198397 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=-10.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 770A2C433E0 for ; Mon, 29 Jun 2020 20:41:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5831020724 for ; Mon, 29 Jun 2020 20:41:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="GHZrNXAb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731691AbgF2Uky (ORCPT ); Mon, 29 Jun 2020 16:40:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730050AbgF2TOJ (ORCPT ); Mon, 29 Jun 2020 15:14:09 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58753C00E3C5 for ; Mon, 29 Jun 2020 05:04:15 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id 22so15124140wmg.1 for ; Mon, 29 Jun 2020 05:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nZJ9RrYkX//UjOI/5YYylQYoHuaDDR4YnVJY1VbZiK8=; b=GHZrNXAbixM8hIlftssrgQxdDlC2R8smynvTThHUqsGw3QGlkt8NhoPhAOcQQGzRtw 8UiJW8UelWWaFm3hR3IBZDUiETIQ4cw/d0cKQJ2t1YCJDD+35seh4iu5J6/ZnfNA9Cf2 0PVuY8rWNQGb4TJy8iFdvM58AtK7sHgm7tkKp+d8JruntQqh4/uEGDPUikx3v8VCVX/X t0nKty1pn7Dat78dI2BiItZ4JxBDOUehXZ0nt2E9AXLK4007faqBTbkxlHvbnLr9M2so H+SDo8uHBGYBqIx7PHreVr5lgWWgBQR/mjyFndySyTN3eQfiaXuMtvjj/R5CALJQPX52 cZCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nZJ9RrYkX//UjOI/5YYylQYoHuaDDR4YnVJY1VbZiK8=; b=t72N8BN7P+oWhRVU24PSQoh3Azl22+6B7dK0pbQl56GpZX0vfdfbRN7BkvskxsJuFT AxP34fjng5Ygjmwjjf0UHynZ8HeVfupG7dhfwHf37NBAHeaRJRldutRqVSO5xR77fjAx cRyKwt8DydjHQKKLHVvFkdIGbyUfuZJ0PJesc7tKk6u6SClB73ypWLQ2mYoGaLCzI2SP oTehBHH/7uQCStPiWDpxw7ZJp87BdA6Es90KMlt0aCg2CDqYb6OTYl2hCHo0difGYRzF TcZsN7cXZlk4G1XfCy5HoeTYBbvsxWpjBSu5k4HzM5EIz+jlF2hckzQlUQhNyJJSfcmr t4HQ== X-Gm-Message-State: AOAM532Ud2DoLFJaqGch8ArVzVKQkknnCgP6OiJj8gbV+DM/kFNUBhbx vKPv2eNwvXpsZe4NEvqXraeU8w== X-Google-Smtp-Source: ABdhPJxPsnR1q89EpF5XRsu5RI2Mrvn6hFviI2UQaVTUzem4LR886XkHZ07utmAJlfbggOLXkkyVfg== X-Received: by 2002:a7b:c381:: with SMTP id s1mr17268979wmj.25.1593432254093; Mon, 29 Jun 2020 05:04:14 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id d81sm25274347wmc.0.2020.06.29.05.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:13 -0700 (PDT) From: Bartosz Golaszewski To: Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 02/10] net: ethernet: ixgbe: don't call devm_mdiobus_free() Date: Mon, 29 Jun 2020 14:03:38 +0200 Message-Id: <20200629120346.4382-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Bartosz Golaszewski The idea behind devres is that the release callbacks are called if probe fails. As we now check the return value of ixgbe_mii_bus_init(), we can drop the call devm_mdiobus_free() in error path as the release callback will be called automatically. Signed-off-by: Bartosz Golaszewski Acked-by: Jeff Kirsher --- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index 2fb97967961c..7980d7265e10 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c @@ -905,7 +905,6 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) struct pci_dev *pdev = adapter->pdev; struct device *dev = &adapter->netdev->dev; struct mii_bus *bus; - int err = -ENODEV; bus = devm_mdiobus_alloc(dev); if (!bus) @@ -923,7 +922,7 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) case IXGBE_DEV_ID_X550EM_A_1G_T: case IXGBE_DEV_ID_X550EM_A_1G_T_L: if (!ixgbe_x550em_a_has_mii(hw)) - goto ixgbe_no_mii_bus; + return -ENODEV; bus->read = &ixgbe_x550em_a_mii_bus_read; bus->write = &ixgbe_x550em_a_mii_bus_write; break; @@ -948,15 +947,8 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) */ hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22; - err = mdiobus_register(bus); - if (!err) { - adapter->mii_bus = bus; - return 0; - } - -ixgbe_no_mii_bus: - devm_mdiobus_free(dev, bus); - return err; + adapter->mii_bus = bus; + return mdiobus_register(bus); } /**