Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1362674imu; Mon, 5 Nov 2018 19:34:56 -0800 (PST) X-Google-Smtp-Source: AJdET5c1frXNkP/XeeWfn0xeDxBSdKWZpv/BptTX96zoyUBSRXbmIOADzVKeIOUz52znZI1l/cYy X-Received: by 2002:a17:902:15c5:: with SMTP id a5-v6mr24516236plh.136.1541475296914; Mon, 05 Nov 2018 19:34:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541475296; cv=none; d=google.com; s=arc-20160816; b=XZ+0XpyMq40FEjsl2oHqDcqE6pxajVcW4PBphZ7zuvMJ4zQMkFPEUGPH5MkIzm9URB L5o1S8yRRRad8y2y9oiiXe9WeOk/Hth6n0TVzM++iTLzLtn5UHEjENBy04OizOYDWsNB XOXmtGIj8fJs7x7o43gFh6XEltTOXhVgzJkElylgxnm0+wycz96sfvffRnUrIrX8JaQl nALa0lRf/hr4EYT5CIYU6cX0v4Qey0/JQS8KPq+1eHO3j2hS1GpGYOF1YdgND0hc7Wub I7P1WlQ6kp9Ux3s2LUh3H13DQuP99h334piqOWPHclLLYWXL26I27pVFgpKWbIYcDbTa 3/FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=/B9c0Siz2cQq+Qlpwp7SPzLyhwUuiU2x/Fb4412Cyko=; b=sgkGaJpCCA/1b2kTclC7U9DaXnoN5WJCwH2kAsfDAqWTaC/NDSXK5ai09BFlzHxUgt pKn9UKMz7za/rgKNny5gm1qK2K7qVcOmNgTyqUVDRbaawqdiDnegcKDqpZNF4vau10Er Qt9yTBC5j2KlCeMl6mBhifSeowAx4WNtLdaAqVhs/DqZFXO2nZFMjzhnB9qCcSSOkMYf zyGXaC+Hn7jylGjL06OoAoWoDGGMwN5Mg2FVZ+KdidBLdlPNiiDkfEqWHWS2rcw7rQge aRMuZBzOHq/8iRWbCg6KKNUFtGLDSc3rwVHK6qre8oHb340GGfwaA6VtEtd3fO5wVA03 lPrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WRG6yWX5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 207-v6si29294705pfw.277.2018.11.05.19.34.28; Mon, 05 Nov 2018 19:34:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WRG6yWX5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387401AbeKFM5A (ORCPT + 99 others); Tue, 6 Nov 2018 07:57:00 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45904 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727049AbeKFM5A (ORCPT ); Tue, 6 Nov 2018 07:57:00 -0500 Received: by mail-pl1-f195.google.com with SMTP id o19-v6so5466564pll.12; Mon, 05 Nov 2018 19:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/B9c0Siz2cQq+Qlpwp7SPzLyhwUuiU2x/Fb4412Cyko=; b=WRG6yWX5Z/OUR89dfsuuY11uJL+1J+ZsaI6bwkea2MrBNZeZwDH7T7CXcrob8AltTZ aTl9/kl1CdUUizyXYGp4WpwLRPZYQTHR1sJRrJBQfXw2TUBK9Y2FYt/faourJbLn/don fK2uHt39gPKX+UagJaOqq0DnKkOBRP4ZnHaIUi/pYlAddYU73bqkgGRq/n4HfOegnedu BufAGn3F8HzLACayRyNU+D+8IfAyToMr+XWbk8X4BX2jsQnfmdeRAmQMAxm/a29ALUQk 2fiWSUO+Zqy1lpq1R8uNyw4zsxwRycz/3T/tMu81LEgacb83BdaoSw3Tx/e7m4p1yPL3 YN9Q== 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=/B9c0Siz2cQq+Qlpwp7SPzLyhwUuiU2x/Fb4412Cyko=; b=ZLCoM3vsA/19R7UsgSTCSLLCd3bEVGxhgKi6g6eqZnZ5amQbqbNtzY/5Gi73So8CxC haqW5GGA0O6DHdeswpM+SaUsyWqNVdMXY/FVEaS5Xta59SAYU2WMuNtMUbNUJ4PJUEjp Xa9CitLXBAIM01Cmh6nM3cX4L3H9KymP/JxDQ6RWzRwWpoGi2gDHshYZQvTRCwImLegH JBwYLXQl93aBfFJz0fKiKjTU139v2DbO+wzNrSQfYmYpnWqz8LHKJGvwQjs+Li8AGS8r MdWuzYabIHQCUUSyR35TtauK1YraAcW/ZRE2iByeOcIhwsh5Es6NdBcTFCLec1j9XiBY RmRg== X-Gm-Message-State: AGRZ1gK/eDvDh0/04LGfnVvcx4x0/HD34bbTb9hW1Q1QJHdPoaHf6cCi ZACWJ0vm+uSCt/c00/PzIYw= X-Received: by 2002:a17:902:b789:: with SMTP id e9-v6mr4823856pls.338.1541475236274; Mon, 05 Nov 2018 19:33:56 -0800 (PST) Received: from localhost.localdomain ([2402:f000:1:4414:1815:546f:dfdc:5850]) by smtp.gmail.com with ESMTPSA id i88-v6sm40639651pfi.66.2018.11.05.19.33.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 19:33:55 -0800 (PST) From: Jia-Ju Bai To: linus.walleij@linaro.org, vkoul@kernel.org, dan.j.williams@intel.com Cc: linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] dma: coh901318: Fix a double-lock bug Date: Tue, 6 Nov 2018 11:33:48 +0800 Message-Id: <20181106033348.27361-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function coh901318_alloc_chan_resources() calls spin_lock_irqsave() before calling coh901318_config(). But coh901318_config() calls spin_lock_irqsave() again in its definition, which may cause a double-lock bug. Because coh901318_config() is only called by coh901318_alloc_chan_resources(), the bug fix is to remove the calls to spin-lock and -unlock functions in coh901318_config(). Signed-off-by: Jia-Ju Bai --- drivers/dma/coh901318.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index eebaba3d9e78..fd862a478738 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c @@ -1807,8 +1807,6 @@ static int coh901318_config(struct coh901318_chan *cohc, int channel = cohc->id; void __iomem *virtbase = cohc->base->virtbase; - spin_lock_irqsave(&cohc->lock, flags); - if (param) p = param; else @@ -1828,8 +1826,6 @@ static int coh901318_config(struct coh901318_chan *cohc, coh901318_set_conf(cohc, p->config); coh901318_set_ctrl(cohc, p->ctrl_lli_last); - spin_unlock_irqrestore(&cohc->lock, flags); - return 0; } -- 2.17.0