From patchwork Thu Sep 5 08:25:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11134789 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70B9B13B1 for ; Fri, 6 Sep 2019 08:43:07 +0000 (UTC) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17F6220842 for ; Fri, 6 Sep 2019 08:43:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.kernel.org header.i=@linux.kernel.org header.b="nrDB3PyX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17F6220842 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=bounce+26986+546+1554929+3438807@linux.kernel.org X-Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by groups.io with SMTP; Fri, 06 Sep 2019 01:43:06 -0700 X-Received: by mail.kernel.org (Postfix) id DE11A2084F; Fri, 6 Sep 2019 08:43:05 +0000 (UTC) X-Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7EC9920842 for ; Fri, 6 Sep 2019 08:43:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7EC9920842 X-Received: by mail-wr1-f67.google.com with SMTP id s18so5666187wrn.1 for ; Fri, 06 Sep 2019 01:43:05 -0700 (PDT) X-Gm-Message-State: APjAAAVjhzqPaZNAoy1QRD75T5MWWghGWMRUXbK5/M5qG6OA7hPzRbj+ bNLO6ij+UX5h8ET8PmVA5YU8XoxkUXQ= X-Google-Smtp-Source: APXvYqzIii4XC/j/CSt9x4REop4GeWmwYcOk/JPE5UvUz8WM0akKh7wZbRPfFoNSolSC98IxD5ao0A== X-Received: by 2002:a5d:66d2:: with SMTP id k18mr6044752wrw.7.1567759382573; Fri, 06 Sep 2019 01:43:02 -0700 (PDT) X-Received: from dell ([95.147.198.36]) by smtp.gmail.com with ESMTPSA id n1sm6205929wrg.67.2019.09.06.01.43.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Sep 2019 01:43:02 -0700 (PDT) Resent-From: Lee Jones Resent-Date: Fri, 6 Sep 2019 09:43:01 +0100 Resent-Message-ID: <20190906084301.GM26880@dell> Resent-To: soc@kernel.org X-Received: from localhost.localdomain ([95.147.198.36]) by smtp.gmail.com with ESMTPSA id a13sm3592687wrf.73.2019.09.05.01.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 01:25:58 -0700 (PDT) From: Lee Jones To: Linuxkernel+Patchwork-Soc via Email Integration Cc: linux-arm-msm@vger.kernel.org, Lee Jones Subject: [RESEND 1/1] soc: qcom: geni: Provide parameter error checking Date: Thu, 5 Sep 2019 09:25:55 +0100 Message-Id: <20190905082555.15020-1-lee.jones@linaro.org> X-TUID: fb2oXpnGfKUD Precedence: Bulk List-Unsubscribe: Sender: patchwork-soc@linux.kernel.org List-Id: Mailing-List: list patchwork-soc@linux.kernel.org; contact patchwork-soc+owner@linux.kernel.org Delivered-To: mailing list patchwork-soc@linux.kernel.org Reply-To: patchwork-soc+owner@linux.kernel.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.kernel.org; q=dns/txt; s=20140610; t=1567759386; bh=XAtqf9Ij/jb/1kRrxo94GueW/txmUWMfdLGhV3tP6hU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=nrDB3PyX5xqASmN8lOl3iZw/tVgfh4lEgbJeVgE6sYAth42qcp1wTqLABcLdU5hrIyc 0Hplx798nt9vBFnp1at43aar84TxW8Ocz+X1seT7H5WBSA7DNYdFdOu0rpsr9tfCzAuDA sByEZBPqkEQOx4/vVpE8yHB+kvQBL1xPMsw= When booting with ACPI, the Geni Serial Engine is not set as the I2C/SPI parent and thus, the wrapper (parent device) is unassigned. This causes the kernel to crash with a null dereference error. Fixes: 8bc529b25354 ("soc: qcom: geni: Add support for ACPI") Acked-by: Bjorn Andersson Reviewed-by: Stephen Boyd Signed-off-by: Lee Jones --- * Collecting Acks NB: If someone could send this to Linus for -rc7, it would make v5.3 work when booting with ACPI, meaning the newly released distros, due out in October will be bootable. I'd be happy to send it myself with a nod from someone prominant (QCom, Andy, Bjorn, etc). drivers/soc/qcom/qcom-geni-se.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c index d5cf953b4337..7d622ea1274e 100644 --- a/drivers/soc/qcom/qcom-geni-se.c +++ b/drivers/soc/qcom/qcom-geni-se.c @@ -630,6 +630,9 @@ int geni_se_tx_dma_prep(struct geni_se *se, void *buf, size_t len, struct geni_wrapper *wrapper = se->wrapper; u32 val; + if (!wrapper) + return -EINVAL; + *iova = dma_map_single(wrapper->dev, buf, len, DMA_TO_DEVICE); if (dma_mapping_error(wrapper->dev, *iova)) return -EIO; @@ -663,6 +666,9 @@ int geni_se_rx_dma_prep(struct geni_se *se, void *buf, size_t len, struct geni_wrapper *wrapper = se->wrapper; u32 val; + if (!wrapper) + return -EINVAL; + *iova = dma_map_single(wrapper->dev, buf, len, DMA_FROM_DEVICE); if (dma_mapping_error(wrapper->dev, *iova)) return -EIO;