From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754461AbdLNX6H (ORCPT ); Thu, 14 Dec 2017 18:58:07 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:39969 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754173AbdLNX6F (ORCPT ); Thu, 14 Dec 2017 18:58:05 -0500 X-Google-Smtp-Source: ACJfBos0AA97Ku2AR2RzUAtXY46PGYlhkiRksBCaEjNEAcWz69PJ1rFi9zcb/0dQsikpfseKyeM7og== From: Florian Fainelli To: netdev@vger.kernel.org Cc: rmk+kernel@armlinux.org.uk, Florian Fainelli , Andrew Lunn , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next] net: phy: phylink: Handle NULL fwnode_handle Date: Thu, 14 Dec 2017 15:57:58 -0800 Message-Id: <20171214235758.26122-1-f.fainelli@gmail.com> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unlike the various of_* routines to fetch properties, fwnode_* routines can have an early check against a NULL fwnode_handle reference which makes them return -EINVAL (see fwnode_call_int_op), thus making it virtually impossible to differentiate what type of error is going on. Have an early check in phylink_register_sfp() so we can keep proceeding with the initialization, there is not much we can do without a valid fwnode_handle except return early and treat this similarly to -ENOENT. Fixes: 8fa7b9b6af25 ("phylink: convert to fwnode") Signed-off-by: Florian Fainelli --- drivers/net/phy/phylink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index c89b8c63f16a..69adc0aa141c 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -506,6 +506,9 @@ static int phylink_register_sfp(struct phylink *pl, struct fwnode_reference_args ref; int ret; + if (!fwnode) + return 0; + ret = fwnode_property_get_reference_args(fwnode, "sfp", NULL, 0, 0, &ref); if (ret < 0) { -- 2.14.1