Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3199963pxb; Mon, 9 Nov 2020 05:26:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwaaRF63U5JVTaKBpdi5MAiuDJQ739yZ8bdtdijYzBa/pLaKsK6RAncr8Ybui+nuCKojX9D X-Received: by 2002:a17:906:4698:: with SMTP id a24mr15682390ejr.90.1604928387982; Mon, 09 Nov 2020 05:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928387; cv=none; d=google.com; s=arc-20160816; b=faTGBtyxdGmpfN+vbmYPF8JiDDzLY+V5CavPAjIAn/JEz/7kP4rBRvdWVx5vPWxqrZ J+OdQ2hNwW/ahPdOmY1d2xNRXjkdgZW3AEiUncrMqs8LhvqLyXu5X50Qp12+uEj0mBId X0qFqTtq9vuo0C6h/ZFsRM6r9J07sWBB7ekD4rFUCsJW94eYh7dbwISGrVoBKVnDJaTi zrMxlOiqTYPmSRECkJCMA/nLAL6tW+nboNCaZttQL6uZjIooqRw/DK6hAiJ9C83MuujQ iGXOLbuaqICdufYwrorr8fMKAtVQJauWNVAAyizEy8IrLhunnl8E4ojRt6I8oNIupSul +eGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o5LcI38fY7kz+yK0Ykz3WY1L6eiQt0Mn3K0/oiIPEZE=; b=FEmxs0CITliA9DQG4A7zuL57Bcsn17k0P6SK60o+GLxwme2b2rf6ol1ag40Rzmonz+ 02dJ4mhEVY+ELTw2PBtqLpMFg27uxCN4X5kZhQX4uiFDuthXzbjsBzg+IOR+8WdDbCwE EcBSlIG6NhH5zooZmg3wpcMnxZImwZ1SUR3T0jvUaPd8YU6y6gO1G3tyX9KUweaf3PzD u+ez6ac0BVHlYlkoGFbs2JQZaWPBHyaVjJNTx3AfEhRUcod5lY10GhBTKLnjlmkTZS2f JgCvKBiA0BSaS0teE8vOpLTwZSYgNTqCuORg4WBUkj5LZs4IOQy6SGC842a4h09s3qI+ PI8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t2+nnS5Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mf25si6998361ejb.54.2020.11.09.05.26.04; Mon, 09 Nov 2020 05:26:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t2+nnS5Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387911AbgKINYu (ORCPT + 99 others); Mon, 9 Nov 2020 08:24:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:46032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731863AbgKINSl (ORCPT ); Mon, 9 Nov 2020 08:18:41 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BDC042076E; Mon, 9 Nov 2020 13:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927920; bh=khB+fXKKincLA3kRo0EB7b7vJ0Ib+IRQFqAu/sTvaOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2+nnS5QlPd5cV7uQPWC5ThWLYc2N/hYGGRgsYXHW5x7ivw15MyxA9eDHof+xN21l dmQ78OVc47WEd7kUNU10ayXeKSSoaCNCpc2ojxeUpggHV5UbaD5NwsoG9rUD8FzM4q CV0u90DIcBefSXYKmeRukA+tanHsk1F1CQNMtvWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.9 036/133] sfp: Fix error handing in sfp_probe() Date: Mon, 9 Nov 2020 13:54:58 +0100 Message-Id: <20201109125032.446747892@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125030.706496283@linuxfoundation.org> References: <20201109125030.706496283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YueHaibing [ Upstream commit 9621618130bf7e83635367c13b9a6ee53935bb37 ] gpiod_to_irq() never return 0, but returns negative in case of error, check it and set gpio_irq to 0. Fixes: 73970055450e ("sfp: add SFP module support") Signed-off-by: YueHaibing Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20201031031053.25264-1-yuehaibing@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/sfp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -2389,7 +2389,8 @@ static int sfp_probe(struct platform_dev continue; sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]); - if (!sfp->gpio_irq[i]) { + if (sfp->gpio_irq[i] < 0) { + sfp->gpio_irq[i] = 0; sfp->need_poll = true; continue; }