Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9964638ybi; Wed, 24 Jul 2019 13:10:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEKsy8XyCQUwFmD/T3Ykwnbnl/BdmUL0sq+yRcaVBlIseKckXUEvIFOfrH3oFgqzZaFTcB X-Received: by 2002:a17:90a:9a95:: with SMTP id e21mr30092018pjp.98.1563999004309; Wed, 24 Jul 2019 13:10:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563999004; cv=none; d=google.com; s=arc-20160816; b=zqHnZ4plG6pRej4Ssi4eh28Afw616peLShDLEx0InuETU9cMGyMgKXnpAqx76QhuDI RTXedVBFrTJAR9MCU1TL1BzEbm/NQJ7FRQNfgYO/Bw/Bc+IsI4C81VCBk+lWs6/dHysS rG501Ejk2C9lxWxKJcVDv8eB6wmQrlni6a0ZlA+eziT6m6X0uApuSUPvpcTboJoNuO3T CLyN29zMlPLZ0r9vHVy5Dq13z/4gGgEjVzNibQSqpYAbJjvkeDJmzr+mO20H73tuSXud bjCSOXghAN+G71FFHjodQxuQV8k6lithBDecxhzblOrpbvP8sHQMLI6+WNqsGBPby4rP L9kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8ewd+XKgGG3CJ9XwR9bGKNDAPya6+J3gZ4tSmOlJWWE=; b=SQdM+usmfKTX1uU46a6vJneCpDeI3QBaQHRhlxAYar48OFKPTkaDtlDsvAc+E7pH2e kArUNDd6n0ud4KOxHil2mAGWe/V1gO9YgQhup35nz/VABfrj9l4AjTu0EKvrm8wnaD2N VYZQpGTqgnLWUUdDK5dWdc/pM9oTlUaf7UApE0tXsZ3VmEqYBZnn+4az2dfC1XA+GaJX bjLBYMfio9R69LuhCj70fdr1qDP6IBjzPInYQvLlDAWQ0zG1LWpFaph7p5869etzfjnD vRuJTXNKatdAbaoWkQQIjPfDnxAc6vjIkeoaJCJKjSXUGhCAU0d1FsZLlaMf0tG6DgcF Zyig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jZhNoHep; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o61si14893411plb.0.2019.07.24.13.09.50; Wed, 24 Jul 2019 13:10:04 -0700 (PDT) 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=@kernel.org header.s=default header.b=jZhNoHep; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392478AbfGXUHV (ORCPT + 99 others); Wed, 24 Jul 2019 16:07:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:54944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388200AbfGXUEF (ORCPT ); Wed, 24 Jul 2019 16:04:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 90462206BA; Wed, 24 Jul 2019 20:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998644; bh=FseExNQ32xhK79d3eEXl5HTDqbLRl4K50b1utmIFb+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jZhNoHepiiAD1Nh3XMEcks4Yzto2I4smiRmqZEHbnPwr3qzdmdGiu7gnWJROteKOP m/UqUAPkz0bu6AW2kluQY2ifP0ux65tPURqJZjXzxDfzDtA6dPGyz4ptdWay+xTvtG ZpBvQlpY7riifAcKh9zw1eaVcxwKhZ8jSS4h4C6E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 065/271] media: s5p-mfc: fix reading min scratch buffer size on MFC v6/v7 Date: Wed, 24 Jul 2019 21:18:54 +0200 Message-Id: <20190724191700.760650475@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit be22203aec440c1761ce8542c2636ac6c8951e3a ] MFC v6 and v7 has no register to read min scratch buffer size, so it has to be read conditionally only if hardware supports it. This fixes following NULL pointer exception on SoCs with MFC v6/v7: 8<--- cut here --- Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = f25837f9 [00000000] *pgd=bd93d835 Internal error: Oops: 17 [#1] PREEMPT SMP ARM Modules linked in: btmrvl_sdio btmrvl bluetooth mwifiex_sdio mwifiex ecdh_generic ecc Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) PC is at s5p_mfc_get_min_scratch_buf_size+0x30/0x3c LR is at s5p_mfc_get_min_scratch_buf_size+0x28/0x3c ... [] (s5p_mfc_get_min_scratch_buf_size) from [] (s5p_mfc_irq+0x814/0xa5c) [] (s5p_mfc_irq) from [] (__handle_irq_event_percpu+0x64/0x3f8) [] (__handle_irq_event_percpu) from [] (handle_irq_event_percpu+0x2c/0x7c) [] (handle_irq_event_percpu) from [] (handle_irq_event+0x38/0x5c) [] (handle_irq_event) from [] (handle_fasteoi_irq+0xc4/0x180) [] (handle_fasteoi_irq) from [] (generic_handle_irq+0x24/0x34) [] (generic_handle_irq) from [] (__handle_domain_irq+0x7c/0xec) [] (__handle_domain_irq) from [] (gic_handle_irq+0x58/0x9c) [] (gic_handle_irq) from [] (__irq_svc+0x70/0xb0) Exception stack(0xe73ddc60 to 0xe73ddca8) ... [] (__irq_svc) from [] (console_unlock+0x5a8/0x6a8) [] (console_unlock) from [] (vprintk_emit+0x118/0x2d8) [] (vprintk_emit) from [] (vprintk_default+0x20/0x28) [] (vprintk_default) from [] (printk+0x30/0x54) [] (printk) from [] (s5p_mfc_init_decode_v6+0x1d4/0x284) [] (s5p_mfc_init_decode_v6) from [] (vb2_start_streaming+0x24/0x150) [] (vb2_start_streaming) from [] (vb2_core_streamon+0x11c/0x15c) [] (vb2_core_streamon) from [] (vidioc_streamon+0x64/0xa0) [] (vidioc_streamon) from [] (__video_do_ioctl+0x28c/0x45c) [] (__video_do_ioctl) from [] (video_usercopy+0x260/0x8a4) [] (video_usercopy) from [] (do_vfs_ioctl+0xb0/0x9fc) [] (do_vfs_ioctl) from [] (ksys_ioctl+0x34/0x58) [] (ksys_ioctl) from [] (ret_fast_syscall+0x0/0x28) Exception stack(0xe73ddfa8 to 0xe73ddff0) ... ---[ end trace 376cf5ba6e0bee93 ]--- Signed-off-by: Marek Szyprowski Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index ca11f8a7569d..4b8516c35bc2 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -527,7 +527,8 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx, dev); ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count, dev); - ctx->scratch_buf_size = s5p_mfc_hw_call(dev->mfc_ops, + if (FW_HAS_E_MIN_SCRATCH_BUF(dev)) + ctx->scratch_buf_size = s5p_mfc_hw_call(dev->mfc_ops, get_min_scratch_buf_size, dev); if (ctx->img_width == 0 || ctx->img_height == 0) ctx->state = MFCINST_ERROR; -- 2.20.1