From patchwork Mon Jul 17 22:01:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 9846385 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 517D260212 for ; Mon, 17 Jul 2017 22:01:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F53C26E54 for ; Mon, 17 Jul 2017 22:01:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7470326E76; Mon, 17 Jul 2017 22:01:23 +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=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 1CFF426E54 for ; Mon, 17 Jul 2017 22:01:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751450AbdGQWBV (ORCPT ); Mon, 17 Jul 2017 18:01:21 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:44174 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751416AbdGQWBU (ORCPT ); Mon, 17 Jul 2017 18:01:20 -0400 Received: from lanttu.localdomain (lanttu-e.localdomain [192.168.1.64]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id 30E1A600C8; Tue, 18 Jul 2017 01:01:16 +0300 (EEST) From: Sakari Ailus To: pavel@ucw.cz, linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com Subject: [PATCH 6/7] omap3isp: Correctly put the last iterated endpoint fwnode always Date: Tue, 18 Jul 2017 01:01:15 +0300 Message-Id: <20170717220116.17886-7-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170717220116.17886-1-sakari.ailus@linux.intel.com> References: <20170717220116.17886-1-sakari.ailus@linux.intel.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 Put the last endpoint fwnode if there are too many endpoints to handle. Also tell the user about about the condition. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- drivers/media/platform/omap3isp/isp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 4e6ba7f90e35..13a8ce4de18b 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -2154,11 +2154,16 @@ static int isp_fwnodes_parse(struct device *dev, if (!notifier->subdevs) return -ENOMEM; - while (notifier->num_subdevs < ISP_MAX_SUBDEVS && - (fwnode = fwnode_graph_get_next_endpoint( - of_fwnode_handle(dev->of_node), fwnode))) { + while ((fwnode = fwnode_graph_get_next_endpoint(dev_fwnode(dev), + fwnode))) { struct isp_async_subdev *isd; + if (notifier->num_subdevs >= ISP_MAX_SUBDEVS) { + dev_warn(dev, "too many endpoints, ignoring\n"); + fwnode_handle_put(fwnode); + break; + } + isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL); if (!isd) goto error;