Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2161308imm; Thu, 19 Jul 2018 14:25:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdAdIp55ypEmw5+Cih3I89aFd/YyY2LZhc2+m4U0I5p0EqrC7O9/Chh4LeaZC2z2Gj0Qzze X-Received: by 2002:a17:902:8601:: with SMTP id f1-v6mr11536006plo.196.1532035536645; Thu, 19 Jul 2018 14:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532035536; cv=none; d=google.com; s=arc-20160816; b=V5Cw+gUY3jqCSq3KcnNokakbqrss2S+Agt/DD7c6RLgbL9EoXpnK/kUJ+NxbX6a7VE ofMNVSWxQePgz4xLo96TXxcVa2onGs13Ie/kvZfkrexb8LT3boKSj5ZGz08AcckDHHfi jARJ2wCjWoGkbE8o8DtzcUNyrlep4tCoukoKN8oAj3StT55IGXTxFY1GA7K7rQpkyXHe +Dw9an5HcfbttLxoUvySsRwnelbmYO8lRKk019siV/vB6u9vlg8ZKLPVUcffwdyiCO/Y w/ekKpyBmemIQ/nKPd5P4bSBWf1R2ouB3mCJOqxz9/8LKdTOLtuq691QntP4Fl9EgfyB DQGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=nIydwmEJRfC1iY/XxQZdQgFy5RjeAHvX3a9Q7CJ/gJ4=; b=PuWlMaB4hSfiwbMx8qzWMWNsEfO//cUk1oVjRKVf5XBA5jbleduK+jLLtDeBT8BYv1 gJQVggXFD2/WCuIhDRPF7GlIo1ffh3XkcvyIwpqPuTqUCDl83gWqyKWTf75KbXQbrB0B N0CMqRPGta2Hn+I9EuFYXBwmmNzBSOtGWeGFIlNx5JyUERnOoEeX+/oTkIvTQPJ+dWaP 2XQBSki2Y2Lb5HD7KHRlbaV7rR1bReOMOiBS8AuxXuQkIGSXSlJ2CFXz/leojX1Tf0i7 uW6opIDXJyYf3tbA2us2tp2vHWHr8+ffDCIYxpeUmZL5g59MLz369dIIf7FzlT7a6CT6 2a0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=YReHMyrR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13-v6si175706pgh.642.2018.07.19.14.25.21; Thu, 19 Jul 2018 14:25:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=YReHMyrR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730749AbeGSWJe (ORCPT + 99 others); Thu, 19 Jul 2018 18:09:34 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:39079 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727609AbeGSWJe (ORCPT ); Thu, 19 Jul 2018 18:09:34 -0400 Received: by mail-it0-f68.google.com with SMTP id g141-v6so9554889ita.4 for ; Thu, 19 Jul 2018 14:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nIydwmEJRfC1iY/XxQZdQgFy5RjeAHvX3a9Q7CJ/gJ4=; b=YReHMyrR+KUiZrWpwDl3fZ8wnmmz8V9jRsR+s0c6IeonnDLwEOX6LEvDJQpWJLs3vb EXHnwYHuKRFE7IXjuPbVA6TuVQvkqCsr9m7b9fyHH+ZCUmMclVoqPzu+AVMhNinNBa46 /XGWov8Y2h/83pwDZ88HdooKp/t1RGwhiBTnAC2IZQA3F5WMr86tiBMylAcY8K98UEWJ rDlHn5oQo4D7K6GgtET2uyUpy6S+/sLZdU2orN+AoWklPR9/x2SX0N6eqPLCVNKQNFeg RxTjUYkptMXYGpV6hRSjebHoq1tii+AcLmQM+YEoBFodlBfPwf197SCK7ZXpeWYvEOTo qpiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nIydwmEJRfC1iY/XxQZdQgFy5RjeAHvX3a9Q7CJ/gJ4=; b=MB/PrC8w47JGJeHmKiwO9byDUm2BKBiXChZ/qVk9i3SLl6777Xzon4BHXMatxFXT2D jgnAXa06O3x4CThbEApzTjdAoky7VR3bpWsO2O2opEef7W3jl2MiXbrWFzOk2pBDzsAK qk1Uli97U+GSsjs+pGIfHKSVFSYwRmv2WocahdEAM3bpLDO7cEyfXVeXJRZr7eGGf3tt SvCDgs7BDsmrp3s59mTzJ+lC5UaEFPQlh2y7947cVMz1t9NmQrBFc78L1CocfYhh6UXz 6zG2EH8bxKyW0yjlHpUvq2zKvvtDbI3SgeyB9PyqL+PE4dqMgB0pES4sXkIIfhmb3yhp d5uQ== X-Gm-Message-State: AOUpUlEyJBhqSPiUcx8uiiYiEicpwyWxquSGb5hKxE4cGnMEL3/7q0Wb ScSeO1ku3/JMr8pXa1yQ5iUL0KeHqOT58sQP8dL66A== X-Received: by 2002:a24:5e0b:: with SMTP id h11-v6mr7030199itb.80.1532035477764; Thu, 19 Jul 2018 14:24:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5e:9402:0:0:0:0:0 with HTTP; Thu, 19 Jul 2018 14:24:37 -0700 (PDT) In-Reply-To: <20180719174728.GK6920@n2100.armlinux.org.uk> References: <20180718161035.7005-1-brgl@bgdev.pl> <20180718161035.7005-5-brgl@bgdev.pl> <20180719174728.GK6920@n2100.armlinux.org.uk> From: Bartosz Golaszewski Date: Thu, 19 Jul 2018 23:24:37 +0200 Message-ID: Subject: Re: [PATCH 4/5] net: add support for nvmem to eth_platform_get_mac_address() To: Russell King - ARM Linux Cc: Sekhar Nori , Kevin Hilman , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Lukas Wunner , Rob Herring , Florian Fainelli , Dan Carpenter , Ivan Khoronzhuk , David Lechner , Greg Kroah-Hartman , Andrew Lunn , Linux ARM , Linux Kernel Mailing List , Linux-OMAP , netdev@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-07-19 19:47 GMT+02:00 Russell King - ARM Linux : > On Wed, Jul 18, 2018 at 06:10:34PM +0200, Bartosz Golaszewski wrote: >> @@ -544,6 +548,31 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) >> from = "arch callback"; >> } >> >> + if (!addr) { >> + nvmem = nvmem_cell_get(dev, "mac-address"); >> + if (IS_ERR(nvmem) && PTR_ERR(nvmem) == -EPROBE_DEFER) > > This is way too verbose. To quote Al Viro from earlier today: > > sigh... > if (IS_ERR(link) && PTR_ERR(link) == -EEXIST) > what the hell is wrong with if (link == ERR_PTR(-EEXIST))? > > I wonder why so many people haven't heard of pointer comparison... ;) > > IS_ERR(ERR_PTR(-EPROBE_DEFER)) is always true - if it wasn't, then > we'd be in for problems. > > So, if you're asserting that nvmem is ERR_PTR(-EPROBE_DEFER) then > there's no need to do the IS_ERR(nvmem) must also be true. Hence, a > simple pointer comparison is sufficient: > > if (nvmem == ERR_PTR(-EPROBE_DEFER)) > return -EPROBE_DEFER; > Hi Russell, this issue is gone now in v3 but thanks for the example - I somehow never thought about it. Bart