Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42175C64ED6 for ; Tue, 14 Feb 2023 16:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=pLMUFLQ3YE5avreOYynTD9YY9Z+5BdrxPamOUXVhqGg=; b=B8AO1jzWbZiRwj LxnkuV4dKxmbTF45z1O5y2gINKTT5gSmVasUxlP/8SwNRkfhXzDH7nW+KOw6reSm3EfKpQ9EfYwib 6dcamHpc6QUBCORdrj42lJf4MP/weDRM/n0qAkqBwnt14EwGkQPPxJU2YEpdQQuUwrD+kAnZW7FQf eFcBnMjdsfEaGg8ds+psW3NadlIEsVpdtSNOEpRQyxayI0VfQZhRi/ULBDCiWLgNI7H0oLOCekOBX zLeLDeDs/VvIWAJLTCNz7amoV3yqSUSwXk7cQAtbhCFe5jYNQxde/p91F3qLx4ZHi5UR/e+xJwSo5 yp376k+LS1zJbAsdKi7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRyG2-002pV3-GZ; Tue, 14 Feb 2023 16:34:18 +0000 Received: from mail.fris.de ([116.203.77.234]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRyFs-002pL5-Ap for linux-arm-kernel@lists.infradead.org; Tue, 14 Feb 2023 16:34:11 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AA599BFAED; Tue, 14 Feb 2023 17:33:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1676392435; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding; bh=uXvqQLB2ducDVDKLFpQL7JrjrtTEw9AsgFdryWzrcek=; b=fk5VondZuRrLk6uEQYDteXpBIZRUVf8yg10Bhg5oq/n59tqyhVLNJUjcZqGt72Gtx49m0L KNsJrwQr5G1eufZKq2nXjOI3zyhrSSQwyJi0MvAkaHngHShmrtsyAnwNWoWHcADCBZFue6 whuQGLkBi0rcVp1jymSkQGjQG6/onhtkP+fwiaX3gUdOxkMPk44ItQIbmkhSJeXUxZL32t uFPypeSR3ALdiR1wWM4C42qUnZ3lE7eC4TgOSSfq/UMzs78yQ/qOpvJjAouqo83jUwK+C5 g2EtAlYlkWc586L6f13jDRuE1UaAe0CBK8owFi3hIq67gijs1MqsiJb/UrHA5g== From: Frieder Schrempf To: Laurent Pinchart , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Mauro Carvalho Chehab , Rui Miguel Silva , Sascha Hauer , Shawn Guo Cc: Frieder Schrempf , Fabio Estevam , NXP Linux Team , Paul Elder , Pengutronix Kernel Team Subject: [PATCH] media: imx: imx7-media-csi: Fix error handling in imx7_csi_async_register() Date: Tue, 14 Feb 2023 17:31:56 +0100 Message-Id: <20230214163200.1448837-1-frieder@fris.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230214_083409_498112_FA66B4D5 X-CRM114-Status: GOOD ( 11.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Frieder Schrempf If fwnode_graph_get_endpoint_by_id() fails and returns NULL, there is no point in going on. Print an error message a abort instead. Also we don't need to check for an existing asd. Any failure of v4l2_async_nf_add_fwnode_remote() should abort the probe. Suggested-by: Laurent Pinchart Signed-off-by: Frieder Schrempf --- drivers/media/platform/nxp/imx7-media-csi.c | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index 886374d3a6ff..a7db310624e2 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -2191,18 +2191,20 @@ static int imx7_csi_async_register(struct imx7_csi *csi) ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(csi->dev), 0, 0, FWNODE_GRAPH_ENDPOINT_NEXT); - if (ep) { - asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep, - struct v4l2_async_subdev); + if (!ep) { + dev_err(csi->dev, "Failed to get remote endpoint\n"); + return -ENOTCONN; + } - fwnode_handle_put(ep); + asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep, + struct v4l2_async_subdev); - if (IS_ERR(asd)) { - ret = PTR_ERR(asd); - /* OK if asd already exists */ - if (ret != -EEXIST) - return ret; - } + fwnode_handle_put(ep); + + if (IS_ERR(asd)) { + ret = PTR_ERR(asd); + dev_err(csi->dev, "Failed to add remote subdev to notifier: %d\n", ret); + return ret; } csi->notifier.ops = &imx7_csi_notify_ops; -- 2.39.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel