From patchwork Wed Dec 26 18:36:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10743271 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 18A901708 for ; Wed, 26 Dec 2018 18:37:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3ABF285D5 for ; Wed, 26 Dec 2018 18:37:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E67DD2879E; Wed, 26 Dec 2018 18:37:31 +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,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 79A0B285D5 for ; Wed, 26 Dec 2018 18:37:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727521AbeLZShZ (ORCPT ); Wed, 26 Dec 2018 13:37:25 -0500 Received: from mta-p5.oit.umn.edu ([134.84.196.205]:38176 "EHLO mta-p5.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727516AbeLZShZ (ORCPT ); Wed, 26 Dec 2018 13:37:25 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id 4B1EB6B8 for ; Wed, 26 Dec 2018 18:37:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ieAEOey9Yr6V for ; Wed, 26 Dec 2018 12:37:24 -0600 (CST) Received: from mail-it1-f200.google.com (mail-it1-f200.google.com [209.85.166.200]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id 19FF176 for ; Wed, 26 Dec 2018 12:37:24 -0600 (CST) Received: by mail-it1-f200.google.com with SMTP id k133so20471408ite.4 for ; Wed, 26 Dec 2018 10:37:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=RPQseQNPwNQ7VvbUJ24R0rEYhsQQrKhb/1O5ll63oVc=; b=fo0U+hhIGalpABVj3V/7JMmfGRFwCWJbfd43HT1Ce95gHt1UnBaUNoCxOiRUGQH4dn WYDQIfWq76XMU+7HcV+V8tJGf88iXmWsB1jriQVZOlaukmz4llJrihDKTNA59w0ByVrv PGbHM62AEQbNO9LoGWCvwf1W/0ZJOFRrI/1WarmfIbmLbZB1j9fS33HjDyaNglSmoRTE Q5R0MyP2D30YgTSjEpGbqXnB1PON5/fGrHuX2XKftPUNyoq0AU6CvfIX+ylHC5qMnZoM sGBGcSFWuZjex71Yaph1fOdmy2nMw0/AOtbEAQlISSaRQuXLE273wLUMP8Cxfk4OyiNX f4cg== 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; bh=RPQseQNPwNQ7VvbUJ24R0rEYhsQQrKhb/1O5ll63oVc=; b=d68wRaybFKcz8LEZNiBZBv7LpgkEJmm57/IO1Llij4HhhdiRSPnk4UIkP9F23nQh60 syQELTDuP0Z+z+HbweRoxsjFC0KPdC+ceE068/HHq5h3upFAHePP4LtB5sQw+MKMvkYO rju6KGj9Q0/NHe6NQFKs1WLpYRSgp02q8H93qa9yr9diEmtvYvQFjO0eY7n/4Vx+T8xt iOAkXmcROlC5hUe6bFK8RCYkhMZwXvci1/Pb+f1LgoJjurDzQVIEodzBnKXL7+1KKmIz h0DZnsSUpw2dcp0R2LPAfavd7nkm1lLPh2x9Cj8BYH8gpoFS9CHfMerjhH1KN1oyilHK r5aQ== X-Gm-Message-State: AA+aEWavlAqm+1azxYC35sRUe8Rf8Hy9MU+DYPlKUt436B+1Pmm2G3dA WXhscDBmDuvpuTpO7lP3AGnDKAXJqwxs2qvttlKJBX3h/Izx/DgeKFdWfNej9AFVcX41u62zM/Y VHTdIUiHbopdEbs5atiWuMdPx X-Received: by 2002:a02:734b:: with SMTP id a11mr12719693jae.62.1545849443721; Wed, 26 Dec 2018 10:37:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/W/suF6Jy0rOEWzsl8pPdXLNxVk3ZUY3DVOdrjZBWHn2aab/5LLp+KZLNhjNY6HBZ4tlE9w8w== X-Received: by 2002:a02:734b:: with SMTP id a11mr12719685jae.62.1545849443496; Wed, 26 Dec 2018 10:37:23 -0800 (PST) Received: from localhost.localdomain (host-173-230-104-22.mnmigsc.mn.minneapolis.us.clients.pavlovmedia.net. [173.230.104.22]) by smtp.gmail.com with ESMTPSA id v202sm13032846ita.13.2018.12.26.10.37.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Dec 2018 10:37:22 -0800 (PST) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Peter Chen , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] usb: chipidea: add a check for the availability of next child Date: Wed, 26 Dec 2018 12:36:43 -0600 Message-Id: <20181226183643.76912-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.2 (Apple Git-113) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_get_next_available_child returns NULL when no child nodes are found. The fix checks its return value instead of assuming a child is found. Signed-off-by: Kangjie Lu --- drivers/usb/chipidea/ci_hdrc_msm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 880009987460..b7f7acef72d4 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -250,6 +250,10 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) ulpi_node = of_get_child_by_name(pdev->dev.of_node, "ulpi"); if (ulpi_node) { phy_node = of_get_next_available_child(ulpi_node, NULL); + if (!phy_node) { + dev_err(&pdev->dev, "no child nodes found\n"); + return -ENODEV; + } ci->hsic = of_device_is_compatible(phy_node, "qcom,usb-hsic-phy"); of_node_put(phy_node); }