From patchwork Wed Aug 27 16:26:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 4789611 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 4DFB8C0338 for ; Wed, 27 Aug 2014 16:26:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91F9D2017D for ; Wed, 27 Aug 2014 16:26:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A851C20127 for ; Wed, 27 Aug 2014 16:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935241AbaH0Q0s (ORCPT ); Wed, 27 Aug 2014 12:26:48 -0400 Received: from mga01.intel.com ([192.55.52.88]:8686 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935240AbaH0Q0r (ORCPT ); Wed, 27 Aug 2014 12:26:47 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 27 Aug 2014 09:26:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,412,1406617200"; d="scan'208";a="590668445" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.168]) by fmsmga002.fm.intel.com with ESMTP; 27 Aug 2014 09:26:11 -0700 Received: from andy by smile with local (Exim 4.84) (envelope-from ) id 1XMg2z-0007Pt-0E; Wed, 27 Aug 2014 19:26:09 +0300 From: Andy Shevchenko To: Baruch Siach , Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko , Subject: [Fixes: PATCH v1] spi: dw: fix kernel crash due to NULL pointer dereference Date: Wed, 27 Aug 2014 19:26:08 +0300 Message-Id: <1409156768-28461-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 obvious fix after the commit d9c73bb8a3a5 "spi: dw: add support for gpio controlled chip select". This patch fixes the issue by using locally defined temporary variable. Signed-off-by: Andy Shevchenko Cc: # v3.16+ --- drivers/spi/spi-dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 29f3314..670f062 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -271,7 +271,7 @@ static void giveback(struct dw_spi *dws) transfer_list); if (!last_transfer->cs_change) - spi_chip_sel(dws, dws->cur_msg->spi, 0); + spi_chip_sel(dws, msg->spi, 0); spi_finalize_current_message(dws->master); }