Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp999150imu; Wed, 23 Jan 2019 09:10:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7J8X2jcyCQveJjB6pnfjGmevDxoZgHxmkllXwht+neTB8pw129ETsoefB6+xAl9ba5Kwce X-Received: by 2002:a17:902:d01:: with SMTP id 1mr3030169plu.127.1548263435838; Wed, 23 Jan 2019 09:10:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548263435; cv=none; d=google.com; s=arc-20160816; b=pmrtgqO8wKiBZ+Cg3Ga5D3tTNpbrUbp2TgBa8ou0DUuJ8+cXGsg6zmAvojbuJVMKj1 kHxV0vFNr8Q0w5nfT/NgxGHl9gHj7Odzu0PfnfOEDgT2bS0UuRkrCEU6MQmI8XlvtYj7 RZTUwNdLer+BkX9llHQKv5tGza99qVKFtKHHuJzKfKRSe3mdptNHSZ7MUJv9iAP65vbR 6e3VMjDb6+gYJ89CuI7K8rWzUoT3rbXyuUw0zC1NB+33RhEOpHwQPFhrMc3SQ5t3hvFL HhwGtckvj9gg1mPe4FuAWTYcnt4zKioikf1CC70ooFRvWz8FX2A17xx3xz09Q+y0ZDIY iInA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tQZNkNhJNalLii6OpSDc6FFmV9lqkUO4OGYFNQvOYB0=; b=R3WS5tCX6ymBk2l+jtU8Fzwu3G4dNryL8LjW+bNwaMMy5UqGm/WO/CI+dpeEsud1bo mbuIDgvFZZ5Bd7Z7HtiA/o4j1B096Fv5vMxzn6qtpntTU3Zd50bU9HeuZei0WtoG0p00 zYkAYH4uWRdF4fmfvVDZ03QmUPCHsgPOvw4nfXqTdZDl/siOsKl8HWVHgq96cnZ7Ek4c KCR0111QQ0KqimJup6re5DtFGejDkRPyPMuMmZax9OsBmvIiDFaldln/+ceaLGhMkXsQ CnXqf16fQp5ye61VCWt48LGoovBcYmODSiWUfaPRNDtQrXDhhA4rcul1q4H48W/81Mna zzwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=BQKoFgSp; 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 b9si18753793pgt.293.2019.01.23.09.10.19; Wed, 23 Jan 2019 09:10:35 -0800 (PST) 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=@lunn.ch header.s=20171124 header.b=BQKoFgSp; 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 S1727132AbfAWRIV (ORCPT + 99 others); Wed, 23 Jan 2019 12:08:21 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:52995 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726262AbfAWRIU (ORCPT ); Wed, 23 Jan 2019 12:08:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=tQZNkNhJNalLii6OpSDc6FFmV9lqkUO4OGYFNQvOYB0=; b=BQKoFgSpJCVPGjVwNNgr+pRefa5nHzcDPwcokhaJEIiVS4BEWSB3QDEZyPiYdv7mYBjwSnVQYnEf/euhl80MvdlMAc0rM9mxaE8HZV3Z7FkfEfUccAE9vqH6H7jQfq13p4fcfzarKqcEOOAxlQlcqgs9MJhWZowRWg4UhSUssCI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1gmM0e-0002wy-AF; Wed, 23 Jan 2019 18:08:16 +0100 Date: Wed, 23 Jan 2019 18:08:16 +0100 From: Andrew Lunn To: Antoine Tenart Cc: davem@davemloft.net, sd@queasysnail.net, f.fainelli@gmail.com, hkallweit1@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com, quentin.schulz@bootlin.com, allan.nielsen@microchip.com Subject: Re: [PATCH net-next 05/10] net: phy: introduce a phy_driver macsec helper Message-ID: <20190123170816.GH5310@lunn.ch> References: <20190123155638.13852-1-antoine.tenart@bootlin.com> <20190123155638.13852-6-antoine.tenart@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190123155638.13852-6-antoine.tenart@bootlin.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +int phy_macsec(struct phy_device *phydev, struct netdev_macsec *macsec) > +{ > + int ret = -EOPNOTSUPP; > + > + if (!phydev->drv) > + return -EIO; > + > + mutex_lock(&phydev->lock); > + > + if (phydev->drv->macsec) > + ret = phydev->drv->macsec(phydev, macsec); > + > + mutex_unlock(&phydev->lock); > + return ret; > +} > +EXPORT_SYMBOL_GPL(phy_macsec); > + > @@ -630,6 +634,10 @@ struct phy_driver { > struct ethtool_tunable *tuna, > const void *data); > int (*set_loopback)(struct phy_device *dev, bool enable); > + > +#ifdef CONFIG_MACSEC > + int (*macsec)(struct phy_device *dev, struct netdev_macsec *macsec); > +#endif Hi Antoine So the member only exists if CONFIG_MACSEC is defined. So i think you need similar protection in phy_macsec() or you are going to try to access a member which sometimes does not exist. Andrew