Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3559266pxb; Mon, 24 Jan 2022 12:12:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvz2K/oHH4SL/LKgNLAQv2Rc6fyaix9NFtRGvvlWBZaO+gGMxXpDKkr/VtqDbFX8ydbi5i X-Received: by 2002:a17:90b:1d11:: with SMTP id on17mr3426706pjb.167.1643055153109; Mon, 24 Jan 2022 12:12:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055153; cv=none; d=google.com; s=arc-20160816; b=pvpcOQQ+EqkDQTKy4meHzx3Zf6yX8t1kHkYHfZi7GQg/SD3L632XFEQQDSOxHcAYkh gHN32ts6d/UxFotEpEOIByg3iIkPuvmdZpPY1Fvk70chFhM+b2uTUwRA0LJ/t58h1SJT f8Y+gItVXSUomLp6dil9vhw0Jp02SiXonEi6Cc9UAXoWHOHFeN1KIj7FJCUIJnf/4tCg NR7tEcIVjcHyga7cw//wIaBwaJm6aCRIQqt9yQR+QJQ7Q12dXGrXtsgwVDzwnLS6hYtK HV0FWzLNVgIVqoVikbjanscyk58uG89uKSmX64n8GIBsv+CZSwjl+UM9mxGwMKH0Ntcm 1GmQ== 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=z7HtrbdZ+bjAVw7CEnAWarNc0gR03pJ9nk+FZKlNo8A=; b=xLnCvnOMTYUDZbRlsWs7gspGX6UHc4g5AZ1ZDm4cN37axUtN8j05ZOz7CEA+DxdKun vt/y57KS9M6pL2aHFGfgsr3FyDyWvRkQskxqA043UlQgKiCTCrsviD8JMzhFbZtD3hYg n2rDoHXIkv09pKnPTOpVJtg/2wvWyz9qEajVmM+do4rUSPl7UJvPtAr+k+Feu/BGdcfI kcE8ptUvu75RyOIuE3GPX4rTsLLeqwlzCV5VMUpGLahc0oAn5e+ZcovV1K82+DHr+1OO +Sj4E8Xz+AvCp5O67zP6RoOva+U4E2pvWjdxb6uC8tSKLlmhJHjKZhUSVOevCfONbppw i7Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YaAuGLsz; 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 w125si13115860pfw.250.2022.01.24.12.12.20; Mon, 24 Jan 2022 12:12:33 -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=YaAuGLsz; 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 S1345241AbiAXTPh (ORCPT + 99 others); Mon, 24 Jan 2022 14:15:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344186AbiAXTHE (ORCPT ); Mon, 24 Jan 2022 14:07:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31D5FC0613A2; Mon, 24 Jan 2022 11:01:31 -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 ams.source.kernel.org (Postfix) with ESMTPS id E3352B8123A; Mon, 24 Jan 2022 19:01:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34A16C340E7; Mon, 24 Jan 2022 19:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050888; bh=YUTWzpfM84kbMmvjPcm2uVWgAWQ4ZG//iF8VVxDS8X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YaAuGLszN3hIfkMuMET5XXkJMn1dK/mZRXkmAodIeskjpKtTL6AgnL7Q2/fIq0RfI H+TRJbnBZZ4lg8MS5QmnVKqCzbaj8BYiJjLVp9lzi6W0/EnLnuEzdKSd2V6o1sxuBl 2sXqAGVsL06Uvl04FnW5rWUnJlsnoOvKjSJL2leE= 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.9 143/157] bcmgenet: add WOL IRQ check Date: Mon, 24 Jan 2022 19:43:53 +0100 Message-Id: <20220124183937.303853809@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@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 @@ -3358,10 +3358,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