From patchwork Wed Aug 27 13:21:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 4788231 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C6771C0338 for ; Wed, 27 Aug 2014 13:24:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0AF72015A for ; Wed, 27 Aug 2014 13:24:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EAE5220123 for ; Wed, 27 Aug 2014 13:24:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933710AbaH0NYN (ORCPT ); Wed, 27 Aug 2014 09:24:13 -0400 Received: from mga01.intel.com ([192.55.52.88]:10728 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933704AbaH0NYM (ORCPT ); Wed, 27 Aug 2014 09:24:12 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 27 Aug 2014 06:23:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,411,1406617200"; d="scan'208";a="590569746" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.168]) by fmsmga002.fm.intel.com with ESMTP; 27 Aug 2014 06:23:21 -0700 Received: from andy by smile with local (Exim 4.84) (envelope-from ) id 1XMdA1-0002gI-BG; Wed, 27 Aug 2014 16:21:13 +0300 From: Andy Shevchenko To: Baruch Siach , Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko , Subject: [PATCH] spi: dw-pci: fix bug when regs left uninitialized Date: Wed, 27 Aug 2014 16:21:12 +0300 Message-Id: <1409145672-10258-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The commit 04f421e7 "spi: dw: use managed resources" changes drivers to use managed functions, but seems wasn't properly tested in PCI case. The regs field of struct dw_spi left uninitialized. Thus, kernel crashes when tries to access to the SPI controller registers. This patch fixes the issue. Signed-off-by: Andy Shevchenko Cc: # v3.14+ --- drivers/spi/spi-dw-pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index e203d8f..473bd52 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c @@ -59,6 +59,8 @@ static int spi_pci_probe(struct pci_dev *pdev, if (ret) return ret; + dws->regs = pcim_iomap_table(pdev)[pci_bar]; + dws->bus_num = 0; dws->num_cs = 4; dws->irq = pdev->irq;