From patchwork Tue Nov 6 10:16:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10670027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1203A175A for ; Tue, 6 Nov 2018 10:15:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02DCF2A2D5 for ; Tue, 6 Nov 2018 10:15:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB4982A2E9; Tue, 6 Nov 2018 10:15:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 992022A2D5 for ; Tue, 6 Nov 2018 10:15:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387796AbeKFTkT (ORCPT ); Tue, 6 Nov 2018 14:40:19 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:33187 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387480AbeKFTkT (ORCPT ); Tue, 6 Nov 2018 14:40:19 -0500 Received: by mail-qt1-f194.google.com with SMTP id l11so1922398qtp.0 for ; Tue, 06 Nov 2018 02:15:49 -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:in-reply-to:references; bh=GEWFqeovu0vbvNHTOLDcyxHr31XFIa9c7Nw2vGc8WE8=; b=c28SQZptfqWw+wHd1YtaGOqn+/R/M21MhmDC9uQc/F/ZUiNQzuextZFzn3jDAryuO0 q2qujqGEhsVAjH8hDC0ctmOD8EPS0tdQoEssMeLNcNqs+sZeNBKNKemtQ+QYd3/qtXno 5SmbhczHEE3KK49ur7s/IdDt3yqtbRMaf3N6ozsXWURIhRI25oBQv4XSmswhvqX6LLN7 5CTsCPZGxJV0pFrA0wBDN8rTQIXNPgYSanuZOeVbe/0zKFuk5a3fyquh/afDDlPd49Xx ENfAIHSlMIlU+Fs2avVCgkIXB2zbiEnAsA/2TowpHfK3kDczA7WBSxo7c/UbPWs/XHBr 9JTA== 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:in-reply-to :references; bh=GEWFqeovu0vbvNHTOLDcyxHr31XFIa9c7Nw2vGc8WE8=; b=gAzbyI84FRWaj+a4+/hGMpVgZCz48PNN86Azgiw6+dwQYbl/cJefA1pMZH46v5Xvcf Dm12HJAWr9gJLxhGJA/je2ktkqgnvvTrY+H+5f1fNaoOY1LvexdyaxwlrhDGOQjWVtpm +nj6TPq35m5ot7JFhxXTR+iqPCeCA2+VwJgzieQJdlpipQyOZBap4ASOokglm4hYaWXC WC7Rv3ccRUMfJvkzf6QcmnAWkK4kBjCmpYbr9AIWEjvE9dqyqCYM2wxEYBXKcjlzdVh8 qIbfTdnBQyXgPI+2jsPFMSilDjpkrryQqRDkph4rQUMiOe6AOqQ9DAoFS2iVRpwNSKor 5hmQ== X-Gm-Message-State: AGRZ1gKg+ZX9spIYRz7cyXK95TbIaLA4khFAhaQ9RIWbzAPDXWO3oG93 uEAN9uY1WAUEanwtQ5/hxjk= X-Google-Smtp-Source: AJdET5fO9SHQC5F4u+Grf4PHuA4esAMEbDVald3D2+vZ/gyeeXps0mvTy7+lOyv56w4Kbu3CmKTo4g== X-Received: by 2002:ac8:5411:: with SMTP id b17mr18810903qtq.259.1541499348657; Tue, 06 Nov 2018 02:15:48 -0800 (PST) Received: from localhost.localdomain ([201.82.144.36]) by smtp.gmail.com with ESMTPSA id s46sm5000062qtc.63.2018.11.06.02.15.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Nov 2018 02:15:48 -0800 (PST) From: Fabio Estevam To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH v3 2/3] media: imx-pxp: Check for pxp_soft_reset() error Date: Tue, 6 Nov 2018 08:16:04 -0200 Message-Id: <1541499365-10069-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541499365-10069-1-git-send-email-festevam@gmail.com> References: <1541499365-10069-1-git-send-email-festevam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pxp_soft_reset() may fail with a timeout, so it is better to propagate the error in this case. Signed-off-by: Fabio Estevam Reviewed-by: Philipp Zabel --- Changes since v2: - Jump to err_clck when pxp_soft_reset() fails. (Philipp) drivers/media/platform/imx-pxp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index 27780f1..986764d 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1607,7 +1607,7 @@ static const struct v4l2_m2m_ops m2m_ops = { .job_abort = pxp_job_abort, }; -static void pxp_soft_reset(struct pxp_dev *dev) +static int pxp_soft_reset(struct pxp_dev *dev) { int ret; u32 val; @@ -1619,11 +1619,15 @@ static void pxp_soft_reset(struct pxp_dev *dev) ret = readl_poll_timeout(dev->mmio + HW_PXP_CTRL, val, val & BM_PXP_CTRL_CLKGATE, 0, 100); - if (ret < 0) + if (ret < 0) { pr_err("PXP reset timeout\n"); + return ret; + } writel(BM_PXP_CTRL_SFTRST, dev->mmio + HW_PXP_CTRL_CLR); writel(BM_PXP_CTRL_CLKGATE, dev->mmio + HW_PXP_CTRL_CLR); + + return 0; } static int pxp_probe(struct platform_device *pdev) @@ -1670,7 +1674,9 @@ static int pxp_probe(struct platform_device *pdev) if (ret < 0) return ret; - pxp_soft_reset(dev); + ret = pxp_soft_reset(dev); + if (ret < 0) + goto err_clk; spin_lock_init(&dev->irqlock);