From patchwork Sat Dec 2 19:26:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10089007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD14860380 for ; Sat, 2 Dec 2017 19:29:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCED02934A for ; Sat, 2 Dec 2017 19:29:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF61B2935B; Sat, 2 Dec 2017 19:29:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D4DD2934A for ; Sat, 2 Dec 2017 19:29:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=cG0E8dAVtW46cPIgIw8+K9QUo7l3KtlcTrwXzVlsoS0=; b=UN0nPfG4s9Ub4m8OkucVXYwp1z u493umZYgXf2LJxHZsPtX3kAWlE9OVL0ZIMGFlAWeU1Ipp+LRsPWpnzSxJq8/jZsdfUEvaqIUx0jC aCEe212G2ui2vktCosC0qzQw7XvPPFiZKsD4T9zQk/u2UozTFarNb0SXATepcBGr3pl7c16kGNS4b LKa9Y4S62YmKCh5JKZ7newhNEOTgqeAASOex2cz17tQ5/csTbWobDOlt70ixoTWqzxekViYMdqqKM Pvf6J4ZX/tEOnJlgQgtqHbt1ixDE6RdvqUA3ravzixFtnAhL9rIohAEIz4JcZPBPSRQpmLHjv4hyk F2pCyz4Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLDTn-0002bd-6l; Sat, 02 Dec 2017 19:29:39 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLDRZ-0000Bb-PU for linux-arm-kernel@lists.infradead.org; Sat, 02 Dec 2017 19:27:27 +0000 Received: by mail-pf0-x244.google.com with SMTP id a90so6101359pfk.1 for ; Sat, 02 Dec 2017 11:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c/w01skmvyGMwSEFlTBH0OiX5hl4ZGAKrevZLfi3YUs=; b=Z+yBLdUg29lrwIYQnWdGtjffCbWPZfZpGwL5ao3+4xkLs3YbmHwBragIqM8Jp4jOJg 5YAaMZofgRq5AZzfSBe+ktWyDRoL2/0HY4eH1DVKQrqLi7MmJrz2FVIzJunDchvdmeif dz732y5buPUkElrscwpuEHRdlMu3ZoVEeEwNK+EfVIJIheL5XbCs8Knf7f+srQZasnva 6X+k6ayIuoYihRsv2ytOS1NnzRsIwgLUjB+IRYnWL+UPRswSagoyIljrGPNY0F3N5jLB V+NKqrkAngOh9o4yfRbY8sMLg5hbGRCaedFlXYdem+aFW4NCn/PRS78JQn9Xep2jWpXG s9fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c/w01skmvyGMwSEFlTBH0OiX5hl4ZGAKrevZLfi3YUs=; b=YWjoJw5gsHTJktP3PbKi+DJvBdYCTegsEwErkAQ8b5O+QBO8AXui4FLKihbm7M7qWo vMReSVUOCjPqh3vGajDiGmYYs5B3H7loh8/leUtMKZr8RK/gVMIeKrIxOhbR1YM4/xaR w83VBBmlSvtjRsa6tbQEK3fU9whwh4+YUqr3CXgIFRzpsnvGizwi/aIpseAOWYvPR+de Vfwqf1rZgFsMHcha7VoagonYvUbjrH0pz0LyGkf6Evyqr1N++JHGekEeLAtoijvRkAt3 X1pCE6tvdInLUJiHEc/hecvNscFSFmQ8TaUAXZaiwRc4B/PzQtKmbV/tsqCxv39eZheL GxeQ== X-Gm-Message-State: AJaThX5SUk3w3F/imaS+6zwg/k6kV3Lgcs/EovX2znfgmwO2+FLWqar/ V4V++pixW8XVPOlfkOte3NQ= X-Google-Smtp-Source: AGs4zMYk0LyC35SplBudAf0YsYVk6QQnMtprXhtKxPTNsw3QksdJmU3SyrZCyF6rps03suOpszneYw== X-Received: by 10.98.207.70 with SMTP id b67mr14462447pfg.220.1512242820578; Sat, 02 Dec 2017 11:27:00 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id 140sm15167899pgd.85.2017.12.02.11.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Dec 2017 11:27:00 -0800 (PST) From: Arvind Yadav To: wg@grandegger.com, mkl@pengutronix.de, michal.simek@xilinx.com, opendmb@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, Vladislav.Zakharov@synopsys.com Subject: [PATCH 08/10] net: fjes: Handle return value of platform_get_irq and platform_get_resource Date: Sun, 3 Dec 2017 00:56:20 +0530 Message-Id: <1512242782-7134-9-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171202_112722_435084_82796BEA X-CRM114-Status: UNSURE ( 9.56 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP platform_get_irq() and platform_get_resource() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/net/fjes/fjes_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index 750954b..540dd51 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -1265,9 +1265,19 @@ static int fjes_probe(struct platform_device *plat_dev) adapter->interrupt_watch_enable = false; res = platform_get_resource(plat_dev, IORESOURCE_MEM, 0); + if (!res) { + err = -EINVAL; + goto err_free_netdev; + } + hw->hw_res.start = res->start; hw->hw_res.size = resource_size(res); hw->hw_res.irq = platform_get_irq(plat_dev, 0); + if (hw->hw_res.irq <= 0) { + err = hw->hw_res.irq ? hw->hw_res.irq : -ENODEV; + goto err_free_netdev; + } + err = fjes_hw_init(&adapter->hw); if (err) goto err_free_netdev;