Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3579340pxb; Mon, 24 Jan 2022 12:41:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmRUJ8o9XXPkBoK8zldnvcTzeBZ1IBBCYkSvMHp9QH7f1Oi6xWBDMxyF4MjdpPzvd/AC7G X-Received: by 2002:a17:90a:9284:: with SMTP id n4mr87664pjo.109.1643056912720; Mon, 24 Jan 2022 12:41:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056912; cv=none; d=google.com; s=arc-20160816; b=JMvTa/1NK5LorMuHKxLSl2nvVJbcqX3dCC1sZQD+9MiWCHKJYXnsKkLeEQmjgq35Ls nqXCwY9GO1LegAWtSA/Awcvu6eRcwAEoyNHp69/o1BKr9gem8W8bgCSPO9prThOiVAUR URrHbAaLAQBfhWB06o1aiyh3+Fbc3RNvUMSwI38o7zxpemUDC7fkss5YpY+1MNVwV6oS 0qxHtgp025PBZldodBIvrcW/zXDFxp9G0+gyL7jVt9OxkzUbEYtjCV92hxKuhgs3NnBG OpwSO7jW6/wosZSkhv2PzpqoKDiy067GaxCGHPpW+y2jQShovJVo2EvPcld6dfqaeIF4 Yqqg== 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=qz3GNTpcpEuQ8JADJZRAMiCLkvLkyNkT1D3ljTpBjl4=; b=d1iMcR5fjSXclW2+hMrmzrflxn9zNCHqMXqwLhBr3RIo+Y1kuRKp8mwoL30iPlvnRN ETCFPfE3PB7TzmCbWr9ZIJ8R9VUuh1yYUfiWaNL9bk9wrDdPE11S6fSnGBMkFBEI7X2h 5wsBAkwTPpwemd0bTs41HcruB3yCJddbk3o2IDYZUNX887dl2B7JVdrII4MLiMYIHI4G UxuXotdn3znuU+W7r+vSN1pgsII6eC97RS7P8Wc43OMovz2qPeHGv+XLaFX5I7x3xOee b0gbXbxT3zgbeIl2DmzuIgC+Rt18iAvw6ETkCAox8rJvGbMJSBtO8xt/VCOtXqUDXLHf JzwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E66Jg5OV; 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=pass (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 p10si13407715pls.262.2022.01.24.12.41.37; Mon, 24 Jan 2022 12:41:52 -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=@linuxfoundation.org header.s=korg header.b=E66Jg5OV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350905AbiAXT6Z (ORCPT + 99 others); Mon, 24 Jan 2022 14:58:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239566AbiAXT0Z (ORCPT ); Mon, 24 Jan 2022 14:26:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 552BAC034610; Mon, 24 Jan 2022 11:12:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E83836124F; Mon, 24 Jan 2022 19:12:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA8CDC340E5; Mon, 24 Jan 2022 19:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051539; bh=M1h1ylrbaY8zqTnpxtxKlP/Przg1xO3AgcgaBoGjoBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E66Jg5OVMO2mSG47DctMg1PcdnyIxCFXIffw4JAC3KVrd6UEVMnChexQpISX9ZlIh RcPyMtOX7p+8vhjNYLhhPE31ERA0Lmi1wXgZ8cedZ1S20BxrzLdZz4vIBUvJ9W/5dd CBE7CYg+GewhCi10gS9NlU6aF5wJlbaJb8SHrXp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Florian Fainelli , "David S. Miller" Subject: [PATCH 4.14 177/186] bcmgenet: add WOL IRQ check Date: Mon, 24 Jan 2022 19:44:12 +0100 Message-Id: <20220124183942.805887072@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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: Sergey Shtylyov commit 9deb48b53e7f4056c2eaa2dc2ee3338df619e4f6 upstream. The driver neglects to check the result of platform_get_irq_optional()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt") Signed-off-by: Sergey Shtylyov Acked-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3519,10 +3519,12 @@ static int bcmgenet_probe(struct platfor /* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled = true; - err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, - dev->name, priv); - if (!err) - device_set_wakeup_capable(&pdev->dev, 1); + if (priv->wol_irq > 0) { + err = devm_request_irq(&pdev->dev, priv->wol_irq, + bcmgenet_wol_isr, 0, dev->name, priv); + if (!err) + device_set_wakeup_capable(&pdev->dev, 1); + } /* Set the needed headroom to account for any possible * features enabling/disabling at runtime