Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5919902imu; Wed, 26 Dec 2018 11:22:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/XK86vmp8r1PUtM9ZzCVmUNiikT4w6fRulLk0KyvHPwjHSyKxCHru9lEy/W4j9NoaUgDUnz X-Received: by 2002:a62:7504:: with SMTP id q4mr20951739pfc.180.1545852154474; Wed, 26 Dec 2018 11:22:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545852154; cv=none; d=google.com; s=arc-20160816; b=k2R5sZsxKfsrR3GO6Nnmd5CCh/s3iO71oKHFVbWqglMqLFAY21wuD/D+Ifs1potEtw WKMOggeuDqg6Yw8WAux2ukGzYxtDTXPnDivYQcpFo+9Uevzn1jvusVv7SMxNsPAPtlQX 6gorUpcVk8yRrQ4MxrF6N4FDPNWibyGGz5MByax48BKV3tbfYn6RU64LTShCc17CMq3t 6Toleq26ytV8bzafaDL+vGd244Fqhv4K29PDwzCkh2h0ukQkU9HMFA6JnnwTcHPgqCue 1u0J5j9zwiKzB/n+Xoy7rV3cStSv8e2jXJmw+9AVvcgE9duL5GHbJzOGGIQuiRIRZEo8 eMaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=RPQseQNPwNQ7VvbUJ24R0rEYhsQQrKhb/1O5ll63oVc=; b=agbzxr2dayaE8QapGd4zMYGw4kP4NZXpbqCpQMjd1Z2HEVgIQITz2Yuqn8nUSMFAJs 5+eaUKmRA77TMrDezIBnBOUyq6gjXk5P9tAaiG8/l9N+Zz5ZvIfpYiPGX48RJtH08dwH LzK6zNSyW+WpVVy0Uo7WDrLwveBpBU5I5lT+h9WYt016F39tEl665gaCABWXsogRaw7X rVFvdHavKeLib2FHTh6Y4ou9KT655KjE/PYOjVVbK3oj3SPmTljMGDK64esZ3tg9fN2I SEwfYNHTONNP2Gg97Tfmpmm5RkdIwkWCxvny8G+xDuL0TVY4GaBBe5V+iM76s+MwGB84 wjDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=fo0U+hhI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cc17si12803080plb.265.2018.12.26.11.22.16; Wed, 26 Dec 2018 11:22:34 -0800 (PST) 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=@umn.edu header.s=google header.b=fo0U+hhI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727536AbeLZSh0 (ORCPT + 99 others); Wed, 26 Dec 2018 13:37:26 -0500 Received: from mta-p5.oit.umn.edu ([134.84.196.205]:38178 "EHLO mta-p5.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727519AbeLZShZ (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 56B3176 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 sWOj0mrybHIZ 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 288D0239 for ; Wed, 26 Dec 2018 12:37:24 -0600 (CST) Received: by mail-it1-f200.google.com with SMTP id 123so20478394itv.6 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=XsXxnh85VjUtIiYSJaRM7ip2nb/4U+49p7M9rBV3bYbuVx8fpRTR41D8L/dUXKvo5U j1eG6yjGsg40odElO7F/xhzhne5+GuFsP5/azuWZHvmSJVErTOSwX3UTSnuao3VXuOUB 0rC28bBDCyZR0A7N4SgEkA8sS3jhZhV1kPqXj0wAWjYmwxy48k1VcLyJ+rtHyfzPWPaD fRa+W6MYO/Y65vHrH9s3x4kY+iiTkL68aIiUFjJSSjKWBgTX7gNd6ReAxmPWyO8sKbWM fTZHaUhNz0gVHD3/M084e3Yt5vkWdIlnwktq032Y312FGSwNeciRCK/R5qN/hYLb52TF 2czQ== X-Gm-Message-State: AA+aEWaIRPO5E+XiQBbgm5URQ1BRn2yP7OeWyyzUJa62WR+xwkYwSU84 4dTaoBs6xpAtwT6Q5p9qOAlXTG9w3mxmf3vdGWGHmjZ/c89TwexELLki3MWGroFkBP5eySq2c2a xd0MqdMxc0borgxfsRrinhKg1DIIh X-Received: by 2002:a02:734b:: with SMTP id a11mr12719695jae.62.1545849443722; Wed, 26 Dec 2018 10:37:23 -0800 (PST) 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.17.2 (Apple Git-113)