Message ID | 1690285689-30233-3-git-send-email-quic_vnivarth@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2426577vqg; Tue, 25 Jul 2023 05:17:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlHcK/V/U6OCKFcp2M4A0cfMlKn31+rK9PQH3gwYSzaZS1KFGB+L1qSsZv42iEZ58ng+rJ7r X-Received: by 2002:a17:907:2cc9:b0:99b:415f:2e4f with SMTP id hg9-20020a1709072cc900b0099b415f2e4fmr12817466ejc.57.1690287460403; Tue, 25 Jul 2023 05:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690287460; cv=none; d=google.com; s=arc-20160816; b=hLDKgdnMsMXMyeG9mtv6xEsu0oGxAAb8SOqCWHC2xL50i5HmMmFAIwabnBhN1LcESL Q9cVbGj0tv8xUeNrUR8k/qw8OwqurwsbrtaBZSNW6G400MAWsiAi24F3Sx5e7vBl2YFD lWpb46u8/wy1m65UmvIHCRwME5nwmhXmKB7WehP1npFF6luXnHrIbTJKi4ESpP1jXwf3 bUxDfY92tjjhDyNIk64yqZz3IGRJpoizLBclpNtP7BCSRwWLQhmveGMsjd78a5484rPk IrfvJba2KfHVID6V1akYDjvmyCGpe6WSMJTcZNjNn3OO32Na5nf1Paba7WJgXZmhhGd/ jh3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=sod3msRdmmhbk+9MCJa7CBZD8q/hqXsIwy8V3MMLdzw=; fh=sUt3fW9BcxbpVnL4H4NNbXPdlBxkplNtYqeLoxhn71o=; b=occa6LpQEtUT0/cOoQIAPKjEY9jDeqIexBM7arhkiem7Iag54Eql5NxjLgSrjBt7nE +tqRvHhS6vMjDJztqPgy0fRUGvospfJ4iI9RMIZB+X7ksuwXUOreazuxVVGPHjEdUtKV 9rmyhQrVDI24ovh5Cqd7Tb5LPkostJwdUF3ByCMOMVV4FZImuNUCrZwI+VVKukf98PUh Lctb+8oM2bkGKYj32fWPQ4P3060aL1TvEsqpyK4YLi8KIn8PemaU6XHgFhEuo7fc1kAr wICJRKhZyFkE1hvbIvoXOzps+w4qswbQNy90s27d/IsRO/PxPPRFg/JU7X3KZ/q2hEV6 OIoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=N5VoduOy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a170906090900b009827e17b069si7999529ejd.1029.2023.07.25.05.17.15; Tue, 25 Jul 2023 05:17:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=N5VoduOy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232834AbjGYLsz (ORCPT <rfc822;kloczko.tomasz@gmail.com> + 99 others); Tue, 25 Jul 2023 07:48:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235135AbjGYLs0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Jul 2023 07:48:26 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C05F10E3; Tue, 25 Jul 2023 04:48:25 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36PBl73p019214; Tue, 25 Jul 2023 11:48:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=qcppdkim1; bh=sod3msRdmmhbk+9MCJa7CBZD8q/hqXsIwy8V3MMLdzw=; b=N5VoduOydDWrgFNK7hgjfTYyBhlcuM0Q2TWFWsQtLjexPqE79vimJsOwtg9kySALBC3q Vi5Zlb+PdX0NK2iwgozXfVnefhhG9cAUU1cMyfsasta9CqwSFXIJBVJ3VtIsMDRd8+TP wLZhPF13Epb636I+n/dO5iUm7KvRKhpa5fSdEFyRJq43K3ALWf30jD37+k7LcujO5Qej heIXrLXrgrLa5AtdcAXipk3AU58Etor4zUrGLOkATLFgHDu1mZvcecNg6Es33SQ7gUc4 jm0j6aGqjP/r3fIQWkjkbZp+TJT6BY+z2v4LUu7Aae6vOqoPkd5Sp6guJIx6JRRiej8X Mg== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s2dqag0bv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jul 2023 11:48:22 +0000 Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 36PBmJ5F008462; Tue, 25 Jul 2023 11:48:19 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 3s086kv0ye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 25 Jul 2023 11:48:19 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36PBmGgW008439; Tue, 25 Jul 2023 11:48:18 GMT Received: from hu-sgudaval-hyd.qualcomm.com (hu-vnivarth-hyd.qualcomm.com [10.213.111.166]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 36PBmIwi008452; Tue, 25 Jul 2023 11:48:18 +0000 Received: by hu-sgudaval-hyd.qualcomm.com (Postfix, from userid 3994820) id A4A0A3434; Tue, 25 Jul 2023 17:18:17 +0530 (+0530) From: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com> To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, broonie@kernel.org, linux-arm-msm@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: quic_msavaliy@quicinc.com, dianders@chromium.org, mka@chromium.org, swboyd@chromium.org, quic_vtanuku@quicinc.com, dan.carpenter@linaro.org, Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com> Subject: [PATCH 2/4] spi: spi-qcom-qspi: Use GFP_ATOMIC flag while allocating for descriptor Date: Tue, 25 Jul 2023 17:18:07 +0530 Message-Id: <1690285689-30233-3-git-send-email-quic_vnivarth@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1690285689-30233-1-git-send-email-quic_vnivarth@quicinc.com> References: <1690285689-30233-1-git-send-email-quic_vnivarth@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: pG_7Nw6ndLAkMfrzn6JktmmFzHT9TSgt X-Proofpoint-ORIG-GUID: pG_7Nw6ndLAkMfrzn6JktmmFzHT9TSgt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-25_06,2023-07-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=692 bulkscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307250103 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772394864159020808 X-GMAIL-MSGID: 1772394864159020808 |
Series |
spi: spi-qcom-qspi: Follow-up patches to DMA mode support
|
|
Commit Message
Vijaya Krishna Nivarthi
July 25, 2023, 11:48 a.m. UTC
While allocating for DMA descriptor, GFP_KERNEL flag is being used and
this allocation happens within critical section with spinlock acquired.
This generates a static checker warning.
Use GFP_ATOMIC to prevent sleeping; and since this increases chances of
allocation failure, add handling accordingly.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/abc223e8-44af-40bb-a0bd-9865b393f435@moroto.mountain/
Signed-off-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
---
drivers/spi/spi-qcom-qspi.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
Hi, On Tue, Jul 25, 2023 at 4:48 AM Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com> wrote: > > While allocating for DMA descriptor, GFP_KERNEL flag is being used and > this allocation happens within critical section with spinlock acquired. > This generates a static checker warning. > > Use GFP_ATOMIC to prevent sleeping; and since this increases chances of > allocation failure, add handling accordingly. > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org> > Closes: https://lore.kernel.org/all/abc223e8-44af-40bb-a0bd-9865b393f435@moroto.mountain/ > Signed-off-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com> > --- > drivers/spi/spi-qcom-qspi.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) Fixes: b5762d95607e ("spi: spi-qcom-qspi: Add DMA mode support") Reviewed-by: Douglas Anderson <dianders@chromium.org>
diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c index b995542..b938908 100644 --- a/drivers/spi/spi-qcom-qspi.c +++ b/drivers/spi/spi-qcom-qspi.c @@ -308,9 +308,11 @@ static int qcom_qspi_alloc_desc(struct qcom_qspi *ctrl, dma_addr_t dma_ptr, dma_addr_t dma_cmd_desc; /* allocate for dma cmd descriptor */ - virt_cmd_desc = dma_pool_alloc(ctrl->dma_cmd_pool, GFP_KERNEL | __GFP_ZERO, &dma_cmd_desc); - if (!virt_cmd_desc) - return -ENOMEM; + virt_cmd_desc = dma_pool_alloc(ctrl->dma_cmd_pool, GFP_ATOMIC | __GFP_ZERO, &dma_cmd_desc); + if (!virt_cmd_desc) { + dev_warn_once(ctrl->dev, "Couldn't find memory for descriptor\n"); + return -EAGAIN; + } ctrl->virt_cmd_desc[ctrl->n_cmd_desc] = virt_cmd_desc; ctrl->dma_cmd_desc[ctrl->n_cmd_desc] = dma_cmd_desc;