From patchwork Tue May 31 20:15:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Echtler X-Patchwork-Id: 9145625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D816E60777 for ; Tue, 31 May 2016 20:16:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCB1123749 for ; Tue, 31 May 2016 20:16:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C18CA264F4; Tue, 31 May 2016 20:16:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AC022654B for ; Tue, 31 May 2016 20:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756450AbcEaUP6 (ORCPT ); Tue, 31 May 2016 16:15:58 -0400 Received: from butterbrot.org ([176.9.106.16]:51078 "EHLO butterbrot.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756429AbcEaUP5 (ORCPT ); Tue, 31 May 2016 16:15:57 -0400 Received: from flunder.fritz.box (ip5f5b204a.dynamic.kabel-deutschland.de [95.91.32.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by butterbrot.org (Postfix) with ESMTPSA id 8DCC14AE039C; Tue, 31 May 2016 22:15:56 +0200 (CEST) From: Florian Echtler To: linux-media@vger.kernel.org, hverkuil@xs4all.nl Cc: linux-input@vger.kernel.org, Florian Echtler , Martin Kaltenbrunner Subject: [PATCH v2 3/3] sur40: fix occasional oopses on device close Date: Tue, 31 May 2016 22:15:33 +0200 Message-Id: <1464725733-22119-3-git-send-email-floe@butterbrot.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464725733-22119-1-git-send-email-floe@butterbrot.org> References: <1464725733-22119-1-git-send-email-floe@butterbrot.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Closing the V4L2 device sometimes triggers a kernel oops. Present patch fixes this. Signed-off-by: Martin Kaltenbrunner Signed-off-by: Florian Echtler --- drivers/input/touchscreen/sur40.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index 64e588c..85dedc1 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c @@ -448,7 +448,7 @@ static void sur40_process_video(struct sur40_state *sur40) /* return error if streaming was stopped in the meantime */ if (sur40->sequence == -1) - goto err_poll; + return; /* mark as finished */ new_buf->vb.vb2_buf.timestamp = ktime_get_ns(); @@ -736,6 +736,7 @@ static int sur40_start_streaming(struct vb2_queue *vq, unsigned int count) static void sur40_stop_streaming(struct vb2_queue *vq) { struct sur40_state *sur40 = vb2_get_drv_priv(vq); + vb2_wait_for_all_buffers(vq); sur40->sequence = -1; /* Release all active buffers */