From patchwork Mon May 6 11:40:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13655333 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C634142E9E for ; Mon, 6 May 2024 11:40:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714995636; cv=none; b=jDgMWimR+zrk+mE+EQJxoEO2xdsToRwCVUrU/UBzEKi0RAwzznKNC/XKYU6bw69EzvQp1dC9Vy8T8giflOJwWg+YOIWtAW0PNhdn0ZRtvniSGMg8Bbrq4NGOZT9UMuwlQ0AgXZwlPJ/9ExkQ9a8ql20jT9nLnZ94m/ANlxmKHJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714995636; c=relaxed/simple; bh=6Rq27B0cqBXcEXe4wotRdlbpgW3xqppwXIUuno2GF70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sc98+mJr8Wn4+yKwoebZ3LMshO/ySugrWmWXUMeY0BXi3oCas06d678kVycfZN+j4Bb0xmM+3mirC13yl731SsT1gMCMEiYgzFvtD12VsHXBWx3yy3Gs7oZlUrFqI+4sK8C1TmRkC+cQ7CJQTpW4kmURxXAgx28ErfZO3ClmV/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=iY0ptTyW; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="iY0ptTyW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=5vvEQdonqhAK3cFmNNinstUg5N1d+o2KAqgFo4CNsT8=; b=iY0ptT yWieqlnTPSFtINnk8wFFdkihnqfoHOqfA8AmLedpL/47H61OJOLQOT2guswEH64X H+J9zmifOQjXY81taDQgjxsGQBHtmz/W/Bnn20O8+fmb7RWzd6M5k8wbJHfEEABX yy2YQzr0/XO5POPM13hXIYOHu7dWwWDe21ssNxE1UK0GLcZt2Z2XkESp9ahNkNgr rm4ZIZ4Hkftq15/MX38BbQUpeuqvBFLb+H4gdnyVdZiLOnxp+BZm/zHriUY9WIG1 LsqbMBYkvTaFqmNGMFCypPuryp5b03xmMb4vT2F0fqA92QI6+3NP9RWs0dDSYxVY dcFgV3u3iPx5w0fA== Received: (qmail 172779 invoked from network); 6 May 2024 13:40:29 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 May 2024 13:40:29 +0200 X-UD-Smtp-Session: l3s3148p1@tvNGiccXbrYgAwDPX0CuAO+oYiCi4tWm From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Dirk Behme , Greg Kroah-Hartman , Jiri Slaby , Geert Uytterhoeven , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 1/4] serial: sh-sci: protect invalidating RXDMA on shutdown Date: Mon, 6 May 2024 13:40:17 +0200 Message-ID: <20240506114016.30498-7-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506114016.30498-6-wsa+renesas@sang-engineering.com> References: <20240506114016.30498-6-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The to-be-fixed commit removed locking when invalidating the DMA RX descriptors on shutdown. It overlooked that there is still a rx_timer running which may still access the protected data. So, re-add the locking. Reported-by: Dirk Behme Closes: https://lore.kernel.org/r/ee6c9e16-9f29-450e-81da-4a8dceaa8fc7@de.bosch.com Fixes: 2c4ee23530ff ("serial: sh-sci: Postpone DMA release when falling back to PIO") Signed-off-by: Wolfram Sang --- drivers/tty/serial/sh-sci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index e512eaa57ed5..a6f3517dce74 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1271,9 +1271,14 @@ static void sci_dma_rx_chan_invalidate(struct sci_port *s) static void sci_dma_rx_release(struct sci_port *s) { struct dma_chan *chan = s->chan_rx_saved; + struct uart_port *port = &s->port; + unsigned long flags; + uart_port_lock_irqsave(port, &flags); s->chan_rx_saved = NULL; sci_dma_rx_chan_invalidate(s); + uart_port_unlock_irqrestore(port, flags); + dmaengine_terminate_sync(chan); dma_free_coherent(chan->device->dev, s->buf_len_rx * 2, s->rx_buf[0], sg_dma_address(&s->sg_rx[0])); From patchwork Mon May 6 11:40:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13655332 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50E13143864 for ; Mon, 6 May 2024 11:40:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714995636; cv=none; b=GhUHPxY7DiCHDPcb1aoMch2+Om4sZgSGdqNyX5Yfwn3WqV7/y6lCQ6JVLhbydxqpM5Y0ZjFaVtViBBxzkQ1Jd5ILltifKBzt9pLHNo34xalO/4wrjkBl1Rkysdnoh1omv1dRnzlYiGPjaYKoPKnLYkjR0Hrqlj1pwleVcIuLrX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714995636; c=relaxed/simple; bh=BsQOXq+ahxAfweHQAWj5mwNGLsEtbwecliFaCCUsygw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a6jW7nAheX3FBNxkxG/Q/Wen9051bEkKw2pZ1NRmwZyB+RmAAwO5LiHeU5g0BbM1AizrMAKI6B+xj4jwPWcY9tgNP4D1wxDHxbBak6hpM4c82J/f+ywQ1LrfPgwfMSy1M6LKmfSnF7k9Mc7Co0o7dpHSM4wNjQ8mB7XrjkJySiQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=gmbYN0eW; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="gmbYN0eW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=3vmDFjar/7zOCQ0E0AN2tIN3W6sFdzg+LLuJUacu2Pw=; b=gmbYN0 eWVvpz13qeB+CpgJkjp6DR7VNk0TN2JEzS1AL2OvdXgr3olGLemUU6Zh0VJyg2ii ZHU8EGzAz6BY08+lbGpAD6Fhvsw/CqnPalBxo/pLbucRc3qG5vJzQFnKPy2zWQ/V tejPXcu6/l1Hf5iZFNanvcwYc8CMSo3TyopoZDkofxjZuFjj4TcBs0pxasac7U5k f4xCkxy3Sanuynmpo1bsKF5sa67UVIhK9VfWwnM1r/uwYF7ZldyTZoKDRPVVbBeu WEaSsrch/ny8MflRmLpTxh/nO0Z2PvsIFzLomm4u7NFfPcTjGeb/dOYU1F7WaPsh los4Y2U4t2QcdLoA== Received: (qmail 172821 invoked from network); 6 May 2024 13:40:30 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 May 2024 13:40:30 +0200 X-UD-Smtp-Session: l3s3148p1@hUhTiccXfrYgAwDPX0CuAO+oYiCi4tWm From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 2/4] serial: sh-sci: describe locking requirements for invalidating RXDMA Date: Mon, 6 May 2024 13:40:18 +0200 Message-ID: <20240506114016.30498-8-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506114016.30498-6-wsa+renesas@sang-engineering.com> References: <20240506114016.30498-6-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Make sure everyone knows that calling this function needs protection. Signed-off-by: Wolfram Sang --- drivers/tty/serial/sh-sci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index a6f3517dce74..09eb0c824b10 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1258,6 +1258,7 @@ static int sci_dma_rx_find_active(struct sci_port *s) return -1; } +/* Must only be called with uart_port_lock taken */ static void sci_dma_rx_chan_invalidate(struct sci_port *s) { unsigned int i; From patchwork Mon May 6 11:40:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13655335 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 252A46EB51 for ; Mon, 6 May 2024 11:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714995636; cv=none; b=SG8fANO/uv3mMI+eqMDNogM5NNdSQ/q0pGMhXGqw0FOJyDTQ2j/mriD9TUVT+UA39bCI7Mm1gRAesHzUCqCbXdZWDkhu5AEV6avvqSLBf9Ul4J2xxgsZLH5Bra6ZIly1NvH2poufG7U4rj68XfvfLv1EXeUsh9PSI1L05esydLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714995636; c=relaxed/simple; bh=vNn4nBjiHVHd0R6UykwuRVMBMzPNZgmYEEMVlqZiy8Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qc1eS0donj6kPQ3eRUT4Ur2uouDxi5inVtpoq5SmjSTVZXJxYIKO5zGZDmrPNFkCN2ahogM8GtjPhKBbZTcaf5brAeIZjLn9TlwDL1dfrhCYejWIAjSxnqJTyqgZ7tkeuE7ECKmKnviCGGXcFX/xRVGi6LBfdeHkiq5gBAB1CMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=A0HdvaR4; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="A0HdvaR4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=1+/fXyDcdDYBqoMNsLyvP3kBF5cFDb+XEH2MDBafQ6s=; b=A0Hdva R4Xk+v0Nl+5IlgTd3GeGcGgRYHs9RVfJhjKzzMlm7hxYYsYhG+/FX9ryO3dU6M7z EKfBgP+lXcplr5BLSrmesb7C7AITCWwxe3PSqCZunflx8DhFLg/GLLY0coYuT4gt j7KvKaSTKYyNIrUxsJ9MBe29+sgFv9jD+paTkv14nD9tj5VSjAxhAKVSUkNjOmrR OhmPsUe8GAzKD0KEqzhq2HnLQhR7pUzijWpMl3X0vkTwWcUH7PRo6LCK+DkpUx5A keIlQMscFjFfnshbLNOgPMaCUNCWw2bWGceuE8CFweACgtmdk7y2tbzBR411UiAv f+3oiHXCe4lxbxdQ== Received: (qmail 172868 invoked from network); 6 May 2024 13:40:31 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 May 2024 13:40:31 +0200 X-UD-Smtp-Session: l3s3148p1@gwJgiccXhLYgAwDPX0CuAO+oYiCi4tWm From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 3/4] serial: sh-sci: let timeout timer only run when DMA is scheduled Date: Mon, 6 May 2024 13:40:19 +0200 Message-ID: <20240506114016.30498-9-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506114016.30498-6-wsa+renesas@sang-engineering.com> References: <20240506114016.30498-6-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The hrtimer for RXDMA timeout was unconditionally restarted in the RXDMA complete handler ignoring the fact that setting up DMA may fail and PIO is used instead. Explicitly stop the timer when DMA is completed and only restart it when setting up DMA was successful. This makes the intention of the timer much clearer, the driver easier to understand and simplifies assumptions about the timer. The latter avoids race conditions if these assumptions were not met or confused. Signed-off-by: Wolfram Sang --- drivers/tty/serial/sh-sci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 09eb0c824b10..7cc354ee6305 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1325,14 +1325,14 @@ static void sci_dma_rx_complete(void *arg) dev_dbg(port->dev, "%s(%d) active cookie %d\n", __func__, port->line, s->active_rx); + hrtimer_cancel(&s->rx_timer); + uart_port_lock_irqsave(port, &flags); active = sci_dma_rx_find_active(s); if (active >= 0) count = sci_dma_rx_push(s, s->rx_buf[active], s->buf_len_rx); - start_hrtimer_us(&s->rx_timer, s->rx_timeout); - if (count) tty_flip_buffer_push(&port->state->port); @@ -1355,6 +1355,9 @@ static void sci_dma_rx_complete(void *arg) uart_port_unlock_irqrestore(port, flags); dev_dbg(port->dev, "%s: cookie %d #%d, new active cookie %d\n", __func__, s->cookie_rx[active], active, s->active_rx); + + start_hrtimer_us(&s->rx_timer, s->rx_timeout); + return; fail: From patchwork Mon May 6 11:40:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13655331 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1B9214262C for ; Mon, 6 May 2024 11:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714995635; cv=none; b=TQhLzBS94EtlY1XFA/IoX7eFa9n1gM4rbRZA5hb+X4hJAymWLnDUaCj4LDKq8V0IBGg1laYGw6YoU9ojU8NDX8EJpZIFEK/v8AsWdd1rIIx+5IML+EpXR9wBX1PD1/V9FD2HdvN2db9PnEHSd+5dvQ3L/wXpaR/oWqKQXeiJYZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714995635; c=relaxed/simple; bh=tZekCqwesM0TH7zbeTcT2ilFSjF/za++SpAUFY+hRMU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HDoWUAhdkzN44dgXyUwgepr6imROUqmiVe3zz4abk5BW4k/T/9EUnv2k1p62a4gtNMFhCBDVov0ZEYBmbVNw/9lHF08KQTrJX1rPSxiQyFRaQtpLiUdKi81If4hoPZl9WHZUcwOSdLTAOuLd01gDQ8cksWf4B6lj2HuSgKKf1lU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=HD4MITfX; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="HD4MITfX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=b0eZn/5/l2EZquZuG8Vtq1BaQMNdvpMDot1jtzd3GNg=; b=HD4MIT fXtOLqSvs5hTbA609YvGcnRMuFmzuICm/BtAj+c7CFjQ+FcgZvTdguYi26x4Gx5x aUwskDia3s9CmBxlYF0vK4tcwVMJWYq0JGmpBQetCLRpJ3MBZMmLR/xejuf7j8iL JLURDLYzEnAFWI2iDSS2dfOzdaAThty39XSG33dTBxgL7IndmgVjAUsw2jsrXVNo O6P7ChA2KzQZQpEuNb0JzAl8IRzJS4viA2Foado0LN/0QR5Uqinl6a32202excsa va0+l5ivdZgiLfM/pFxO+I/0EmdqzX9hH0wL9YoiFQQlUNAn42T1GEteyK6X9oDQ exAdH/P/YqpZfaeA== Received: (qmail 172901 invoked from network); 6 May 2024 13:40:32 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 May 2024 13:40:32 +0200 X-UD-Smtp-Session: l3s3148p1@fa5riccXlLYgAwDPX0CuAO+oYiCi4tWm From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 4/4] serial: sh-sci: simplify locking when re-issuing RXDMA fails Date: Mon, 6 May 2024 13:40:20 +0200 Message-ID: <20240506114016.30498-10-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240506114016.30498-6-wsa+renesas@sang-engineering.com> References: <20240506114016.30498-6-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Avoid a superfluous unlock/lock-pair by simply moving the printout to the end of bailing out. Signed-off-by: Wolfram Sang --- drivers/tty/serial/sh-sci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 7cc354ee6305..4dc9c142690a 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1361,14 +1361,12 @@ static void sci_dma_rx_complete(void *arg) return; fail: - uart_port_unlock_irqrestore(port, flags); - dev_warn(port->dev, "Failed submitting Rx DMA descriptor\n"); /* Switch to PIO */ - uart_port_lock_irqsave(port, &flags); dmaengine_terminate_async(chan); sci_dma_rx_chan_invalidate(s); sci_dma_rx_reenable_irq(s); uart_port_unlock_irqrestore(port, flags); + dev_warn(port->dev, "Failed submitting Rx DMA descriptor\n"); } static void sci_dma_tx_release(struct sci_port *s)