From patchwork Wed Jul 18 16:10:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10532817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E2991600F4 for ; Wed, 18 Jul 2018 16:12:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3317290A4 for ; Wed, 18 Jul 2018 16:12:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C646D290B9; Wed, 18 Jul 2018 16:12:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EF7E290A4 for ; Wed, 18 Jul 2018 16:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731520AbeGRQtU (ORCPT ); Wed, 18 Jul 2018 12:49:20 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:51232 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731455AbeGRQtT (ORCPT ); Wed, 18 Jul 2018 12:49:19 -0400 Received: by mail-wm0-f50.google.com with SMTP id h3-v6so2924715wmb.1 for ; Wed, 18 Jul 2018 09:10:44 -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; bh=AZzCltgnNdPyeZzXiMFjWCg4GFVgDog5WHEdONSaQYA=; b=0YpQBTGjX84ndXw1Qum4CiP3P2WxZurvYZThnuNXWR08RnwbPI4e2GjvoVhUdyEBth GxlkSsth9vK6cOICNeN9DdEtvnvF74ZfP3/vuLuJArkElGJV1YNsYRqHCgERqCOVHQ34 SXrgeL6dBhbLeWlU8Z4JNeI7RB6s/eLqa5j0O8lkGcKo1fiwwLM83cgkxhwz4wrhhNVD RnVS5Emrddpb289sl2cJYb1sfT2soXpIJtm9c/RgLXQ7nwb7a6BfGQBCBO4F2wXAPiuK MYGpqbtrLZDXIke2bNcTOC1WtgoXZsWF8a0yEQWSQyaY0AHTRjHGwPKg8wJzrA55WbPG FDdA== 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; bh=AZzCltgnNdPyeZzXiMFjWCg4GFVgDog5WHEdONSaQYA=; b=FrY+14kilHtQsucHKb8VRIcKpDzQfE9IX4kSoKj8aa1ceXX/o7BbNd8gp0RuLvLWqK W+WzL/54IxQKcZVLEVqoWzd0KfuVWsQ0SSCrXNHv+6TOGNNZbd7jjTnSebjosqS9FpGQ OgSKT6klejs9FcR28u/lxp1vktec3V9PwJ99LhbdsXbGXsOes0HSb7WiKJd1KSJE74GP 1dDu55VzjvFFsab4DkJ4zeHYWnKMcAq8bjhBRH9yQnU/h80gcv+btSG2FHYTg89msfvh nbV0zywbiXeN4fBWoHmUuC2lxS/R+4NPttpKD8XHRr3ST4hqqKIRGcfuRb7nXipP6x0A wYig== X-Gm-Message-State: AOUpUlFIBL+eTZ2jZ9X2EW7ivrGUkjqfTWyNo5V4Y8oDOELjdlfjreRs +t5TFKs50iLsZZiSo6sN0XKLkQ== X-Google-Smtp-Source: AAOMgpe57NW0DQDrONhZjG8SlJwhk7i/pp3Ii9AltAolWcQJMvLYWVi8kJi6JCEEY5x61NvhhAjheA== X-Received: by 2002:a1c:888e:: with SMTP id k136-v6mr2069766wmd.6.1531930243447; Wed, 18 Jul 2018 09:10:43 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id v185-v6sm2847803wme.30.2018.07.18.09.10.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 09:10:42 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Lukas Wunner , Rob Herring , Florian Fainelli , Dan Carpenter , Ivan Khoronzhuk , David Lechner , Greg Kroah-Hartman , Andrew Lunn Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 1/5] net: visually shrink eth_platform_get_mac_address() Date: Wed, 18 Jul 2018 18:10:31 +0200 Message-Id: <20180718161035.7005-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180718161035.7005-1-brgl@bgdev.pl> References: <20180718161035.7005-1-brgl@bgdev.pl> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Initialize the variables with proper values so that we save a few lines of code before we extend this function in the follow-up patches. Signed-off-by: Bartosz Golaszewski --- net/ethernet/eth.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index ee28440f57c5..da8530879e1e 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -527,15 +527,10 @@ unsigned char * __weak arch_get_platform_mac_address(void) int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) { - const unsigned char *addr; - struct device_node *dp; + struct device_node *dp = dev_is_pci(dev) ? + pci_device_to_OF_node(to_pci_dev(dev)) : dev->of_node; + const unsigned char *addr = NULL; - if (dev_is_pci(dev)) - dp = pci_device_to_OF_node(to_pci_dev(dev)); - else - dp = dev->of_node; - - addr = NULL; if (dp) addr = of_get_mac_address(dp); if (!addr)