Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp2028051lqp; Tue, 16 Apr 2024 05:36:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6fo1bUPIynmNqaqB1+Xf1PtxPTk0XlS70baISwZlHfv9Neg7Iax7Oqpo6PmcB+3dscBTtBoxlgizH+ATst0imttCSPRwdEvqYywpUZA== X-Google-Smtp-Source: AGHT+IG79t8BM5evCbGtC1QpZMM+dyK1eSO9x0Pff+SziGhWo3ladXhLzgJKxC5zFHybMgmRKLop X-Received: by 2002:a05:6a00:9389:b0:6ed:21b1:e230 with SMTP id ka9-20020a056a00938900b006ed21b1e230mr11742350pfb.19.1713270982991; Tue, 16 Apr 2024 05:36:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713270982; cv=pass; d=google.com; s=arc-20160816; b=KCemyt1YBw1c3lvgHoGcfm6T05U2gvoIdVfVYkSyHLEB0bwvkF55dExfX5/oZk6fz3 abZsirkZ4wbFp2UH72uJJ665tOU2ZQkQo1ZLsZEUc/nnal8EuVijq9nGGbm2khw4B+mX R6JawxAY3x+Quc3tAZClwRDaEw6KO7KN+uPuebmKB7F0jxPzFS+NbRa6E1PnYVlZTtFW aVhy8l55wR5JH5sGZYIEfuiIh/fudC6VvyuDT6SMlk8lP6Ka16VbDrehZhx8KV887wPr yQZRKz1hAAPWcJNxqryOre5ck7dKth1NI2NCcvlcNzITMW0EsvM0GRp2Ja88VPB0khg5 Lx5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Lp5vlYVFCcetgnIn4HW8dGgnYXxUPUENhUOs0STSU6g=; fh=s/g3bJQTODSf0YLOguVZN4k/u/Uwr7PPM1PidXVqe9c=; b=uYXTbof9sMgHjSQ2Ym2QCRMCLFeZla5i1+3xWEUG/MHKtF9RGAY4nndSWDnq6NEbP5 dNq4feWVLzwNF8BBPFHWK/l7NXE8KnBW/y7Vjor6brlBhdy+OZ3+9eGB8VU5CLiiUpPD Vg1B6MkGKue70m5+BMAIBia3iITV4JeJoGKS14dPTqzW7WLFQtatfPhwH3fSVcoi57a/ WxUv+HESRx/2m75j9LULNIxMoImIyrQqwUUjxd4w2jV+HJQM8HGIT1cdfW4OrIvTcmtf +V4nxRTU5LsdhrYOE+oz7S4Qt37L8R6T6QLksgt+ryqPqNYHC7+WUAlunPjMw2JEl8iy I3hQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=FhhpJA0y; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-146799-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146799-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l24-20020a63da58000000b005dcae4c1ff4si9878652pgj.172.2024.04.16.05.36.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 05:36:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146799-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=FhhpJA0y; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-146799-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146799-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AC1312841D7 for ; Tue, 16 Apr 2024 12:36:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BDCF12BF34; Tue, 16 Apr 2024 12:35:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="FhhpJA0y" 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 8977C12BE89 for ; Tue, 16 Apr 2024 12:35:54 +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=1713270956; cv=none; b=lJRprB5Rormdzg5dExgUba0jjG9OKhsnZ81ECWktFuPVZwYgDHzg/+zOWbGimemTOJ81N/HnpsftD7HUj1pke2RrnFR1QnEBv6YWdEljkBR8YuUK8N0PPtREE733ghp0eRvNXye1AbxmtyIwEG6xitvF3kzbq4/bxFCHUYnJx0Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713270956; c=relaxed/simple; bh=Y0tLSlgC1RFiT3mPqR8mah4c1H2bj6CTLAIREfC/r58=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I9kG5n/rtvqqBj5OsuhQmcC3AYiEtZyov0xVgzUGT37I4iT5gNThZZZhWyNB3v6QT8RJcFk55t6HiV2VK/8xPiQ3GCQkRExJVTN1CaVSbLO48/7yFTkGxtSb18PyY3S5NMWXb601aMTJx2M1nrmy5wzhRPfEs1v8UN7YZ3eF1+M= 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=FhhpJA0y; 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 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=Lp5vlYVFCcetgnIn4HW8dGgnYXxUPUENhUOs0STSU6g=; b=FhhpJA 0ylNFUBo2tliReQZEop/eRBFqhFIeJRPi2jN++Eh6xStzIsu9mE6VwK7N8eR3+i6 0xPx0LwD2RwD3EgYxPCgfszwXfrkJe30YTaRWrjiaZ+wcA3K6Pwh0NwWLaE5ZGIw o3aFRT1sqMZxVbjexi593g5JwDPb2YgqREqjtELJQgIxl174jr/Z3YGZc5+oyN3I lMsj4DBQoSjcNChpF/5cTkmwTcKZK+ycWT+ETw8ka2rM94PFFLbd4GVF8ZC8AwWi mELKb+r5Y2HH5y5RIMaeA+0wsrpzKshNwFoEl8OyeIeHXyyIRZ7QruL6ehNoXjr+ A4todJ6ukmmTb1Tg== Received: (qmail 2408475 invoked from network); 16 Apr 2024 14:35:52 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 16 Apr 2024 14:35:52 +0200 X-UD-Smtp-Session: l3s3148p1@zQCB+jUW6psgAwDPXxiyACzheF6dGXh7 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: [RFC PATCH 1/2] serial: sh-sci: start hrtimer after setting up DMA Date: Tue, 16 Apr 2024 14:35:47 +0200 Message-ID: <20240416123545.7098-5-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240416123545.7098-4-wsa+renesas@sang-engineering.com> References: <20240416123545.7098-4-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In the RX DMA completion handler, the hrtimer was restarted before DMA was set up. If DMA failed, for some reason, it would clean up and the hrtimer would run into a NULL-pointer. Restart the timer after DMA was successfully set up. Reported-by: Dirk Behme Closes: https://lore.kernel.org/r/ee6c9e16-9f29-450e-81da-4a8dceaa8fc7@de.bosch.com Fixes: 67f462b069e9 ("serial: sh-sci: Get rid of the workqueue to handle receive DMA requests") Signed-off-by: Wolfram Sang --- drivers/tty/serial/sh-sci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index e512eaa57ed5..1e3c26c11c49 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1325,8 +1325,6 @@ static void sci_dma_rx_complete(void *arg) 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); @@ -1346,6 +1344,8 @@ static void sci_dma_rx_complete(void *arg) dma_async_issue_pending(chan); + start_hrtimer_us(&s->rx_timer, s->rx_timeout); + 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); -- 2.43.0