From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S974983AbdDXTsU (ORCPT ); Mon, 24 Apr 2017 15:48:20 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:56774 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S972541AbdDXTsL (ORCPT ); Mon, 24 Apr 2017 15:48:11 -0400 Date: Mon, 24 Apr 2017 15:48:06 -0400 (EDT) Message-Id: <20170424.154806.387657447648095027.davem@davemloft.net> To: bianpan201602@163.com Cc: f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bianpan2016@163.com Subject: Re: [PATCH 1/1] net: bcmgenet: fix incorrect return value checks From: David Miller In-Reply-To: <1492941665-17155-1-git-send-email-bianpan201602@163.com> References: <1492941665-17155-1-git-send-email-bianpan201602@163.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 24 Apr 2017 12:06:46 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian Date: Sun, 23 Apr 2017 18:01:05 +0800 > From: Pan Bian > > Function platform_get_irq() will return a negative value on errors. > However, in function bcmgenet_probe(), 0 is considered as a flag of > error. This patch fixes the bug by checking whether the return value of > platform_get_irq() is less than 0. > > Signed-off-by: Pan Bian I'm definitely not confident enough to apply this. On some platform zero IRQs are invalid. There are also lots of pieces of code that check the return value "> 0" as success.