From patchwork Mon Jul 9 08:42:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 10514051 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 22C756032A for ; Mon, 9 Jul 2018 08:44:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C88D288E5 for ; Mon, 9 Jul 2018 08:44:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F314928A5C; Mon, 9 Jul 2018 08:44:55 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 0332E288E5 for ; Mon, 9 Jul 2018 08:44:55 +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: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:In-Reply-To: References:List-Owner; bh=eZZtL8mmt8RFzz4ckh8T7J7coEPnUpIYr6b165UdUOw=; b=ThV Re/vYOqNc6Giq/gQzP9h47aWLtbxrDCEOm/47RWrmK4/zP753FEhqqbj8UrAed8VDhMhGXnaoxCOb GPHiVWUUAtkfiV+TcT+Vyg7pY2uCvxongjNHGWYstw6mCoQ06SZOuQVudSVHzITndgwDSWqUe9XKs ci4tQVg2v9DqAEvo7WlYvr3NbdItYOww91BfcsXDXVsmZArq+JtmRxfnGL3Jc+0TdnrfJoNGH7uel 7kSo32l9MarjYVqilz/zJPo6dkNdAysLZfaP9VUdje+Npk0q2c5OySpAcMb/aGggbxVCUUCSCciWy Scz9sr7pj/O+f4Xk/fSqUU+srzQD9xQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcRmu-0002qz-VV; Mon, 09 Jul 2018 08:44:52 +0000 Received: from www.osadl.org ([62.245.132.105]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcRmq-0002pq-Oc for linux-arm-kernel@lists.infradead.org; Mon, 09 Jul 2018 08:44:50 +0000 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w698hQVG027720; Mon, 9 Jul 2018 10:43:26 +0200 From: Nicholas Mc Guire To: Michal Simek Subject: [PATCH] microblaze: warn if of_iomap() failed Date: Mon, 9 Jul 2018 10:42:44 +0200 Message-Id: <1531125764-25816-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180709_014449_105487_7B0B2214 X-CRM114-Status: UNSURE ( 8.88 ) 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Nicholas Mc Guire 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 of_iomap() can return NULL. The function is void thus error propagation is not possible but at least a WARN_ON() seems warranted here as a silent failure might lead to a hard to understand system state. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental coccinelle script Probably this should be a BUG_ON() as this is such a low level fault that continuing operations probably makes little sense. Patch was compiletested with: mmu_defconfig (implies CONFIG_PCI_XILINX=y) Patch is against 4.18-rc3 (localversion-next is next-20180709) arch/microblaze/pci/xilinx_pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/microblaze/pci/xilinx_pci.c b/arch/microblaze/pci/xilinx_pci.c index 14c7da5f..7fa72ff 100644 --- a/arch/microblaze/pci/xilinx_pci.c +++ b/arch/microblaze/pci/xilinx_pci.c @@ -157,6 +157,7 @@ void __init xilinx_pci_init(void) /* Set the max bus number to 255, and bus/subbus no's to 0 */ pci_reg = of_iomap(pci_node, 0); + WARN_ON(!pci_reg); out_be32(pci_reg + XPLB_PCI_BUS, 0x000000ff); iounmap(pci_reg);