From patchwork Fri Aug 10 09:13:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10562513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13F94139A for ; Fri, 10 Aug 2018 09:14:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03FBB2B7F4 for ; Fri, 10 Aug 2018 09:14:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBF1B2B860; Fri, 10 Aug 2018 09:13:59 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 796152B7F4 for ; Fri, 10 Aug 2018 09:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727025AbeHJLm6 (ORCPT ); Fri, 10 Aug 2018 07:42:58 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40653 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726963AbeHJLm6 (ORCPT ); Fri, 10 Aug 2018 07:42:58 -0400 Received: by mail-wr1-f66.google.com with SMTP id h15-v6so7641986wrs.7 for ; Fri, 10 Aug 2018 02:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=sN96MkAkSAk5peqja7EI7GfPAZIenrIt+iqLM7JFBvM=; b=O3oVgWdDI7x5PEW2EgsgSyfH6jzgyZVkk+rc/TgUMZ6Xc7ldLDHzvFDuTlpb5dzcPq SMA0DEroSzKJUQ2uOah1/3LHczfQkuVTVKF3MWf2W5SBsM5a+o1bawi3wrfC/9pyAFNw LoJvE9bDYOUK5DpxZ/lQ2m780ITR6utO+3U9QTTzA8bvSSEDYy/2OHDrpwU7tyWtAyBX Zju8J0nUJEtkrj3cwid7u6V67VGkCUpVyzWeXCy94zkfQJSqMJPUKYPRNfZw5oB9j5BI KEPpCpIuBxrJKe/myrU9Hv7Gx30Mgej4FvAFTdYDZMXW46oVyTDyc7ewCJsmgDu+62yP wMyg== 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; bh=sN96MkAkSAk5peqja7EI7GfPAZIenrIt+iqLM7JFBvM=; b=nK5N1QDebNGmQgPtUBd+aahUlz5IFGPx871LyomHGjlg57O9HeivTQ3DEVQDY0883G RNCtv5B0ZLsA2MIwBwwF7D1APQsh4bXRGnXAclKD10O0j8ZHzog0KH8CtZkVaKGormVY 1w7OatQOCLgTgRSHLJELG/Srv1rrkDNV1aBrdaClQJGDR/NpbMQvmWrb+DNGQa7UNOOc ot5hO96kNp3SWctH8MPTo+y39kYBfdHqnYnvV/6b25s90NCRME51v7/Liqt6jkqcDApi XLP1yDI2Rupza4f22Dzf82tEV1sFiDOLL1EUh3SKC2UJwKBwOtu3ATQhaffRx7p8GAXq ekgA== X-Gm-Message-State: AOUpUlFODnUkQAhjWMdbiWhphBUl/E0T/AZVyxXfn3gg46tH8RvxxD4n Jimlssq/t+QFe3heSi0ytzRHpmZiIWE= X-Google-Smtp-Source: AA+uWPwkWe8Jx5i41eMfshVn/6GkPnTjwjV8XxQZQB2XV/v4RrRSbUxB24yFBMR5kffCRrOKfp7XKA== X-Received: by 2002:adf:97cf:: with SMTP id t15-v6mr3962897wrb.283.1533892437425; Fri, 10 Aug 2018 02:13:57 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id o6-v6sm800418wmc.15.2018.08.10.02.13.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 02:13:56 -0700 (PDT) From: Bartosz Golaszewski To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH] spi: davinci: fix a NULL pointer dereference Date: Fri, 10 Aug 2018 11:13:52 +0200 Message-Id: <20180810091352.30227-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski On non-OF systems spi->controlled_data may be NULL. This causes a NULL pointer derefence on dm365-evm. Signed-off-by: Bartosz Golaszewski --- drivers/spi/spi-davinci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 577084bb911b..a02099c90c5c 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -217,7 +217,7 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) pdata = &dspi->pdata; /* program delay transfers if tx_delay is non zero */ - if (spicfg->wdelay) + if (spicfg && spicfg->wdelay) spidat1 |= SPIDAT1_WDEL; /*