From patchwork Wed Dec 26 02:01:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10742775 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 40A1814DE for ; Wed, 26 Dec 2018 02:02:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26102289D7 for ; Wed, 26 Dec 2018 02:02:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19E38289BA; Wed, 26 Dec 2018 02:02:30 +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 1459E289BC for ; Wed, 26 Dec 2018 02:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725912AbeLZCCY (ORCPT ); Tue, 25 Dec 2018 21:02:24 -0500 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:59676 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725863AbeLZCCY (ORCPT ); Tue, 25 Dec 2018 21:02:24 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id B2B31BC2 for ; Wed, 26 Dec 2018 02:02:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p6.oit.umn.edu ([127.0.0.1]) by localhost (mta-p6.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n8hPD-pIWEJG for ; Tue, 25 Dec 2018 20:02:22 -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-p6.oit.umn.edu (Postfix) with ESMTPS id 8464FBC9 for ; Tue, 25 Dec 2018 20:02:22 -0600 (CST) Received: by mail-it1-f200.google.com with SMTP id 128so18498441itw.8 for ; Tue, 25 Dec 2018 18:02:22 -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=Xq1HBvnjFfNJNnWuxVn5ROpEAKyNRiGk+MUo14uJR8Y=; b=hOM6r+zxfYU/iuopS/1y9fR3NtHNxR8jw7w2S5C680fzJpXi0ItFBRCT5Rja4E5EO3 PjsR8U+BlRV2b2IazgvUakttDKH9prjn25iBNV5RzkETBWe8AYe3MP4/S83S1ZKMojOJ udbWYC3zD8Xsq9rlhPvPIYqrJSJyxRlEyOvRxWs5Cbkl8FNNlufH5hVg30FBmzwV98cA Ri0z64yQpo94jIgQ+3OISsJjINv7IbxeLIQ3/5888oncoL8Wl0v6iZycNCg9Enw2fuYN UfyRpp/MsMEyAl5kP0zNSkuAU1GF75R/rFevZzPysFxRVuy1H4JCwxqqjdVTi8sQE5Su udkA== 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=Xq1HBvnjFfNJNnWuxVn5ROpEAKyNRiGk+MUo14uJR8Y=; b=ntnX/g0oApqRSbJkPvcftFEaF++fegejKqWW9ramkfpQD+ZvNBgy+TGR6nn7kxkU8P YCH3K0vxlCtQHD38ZcmS4NQ23TyneKJQgB76MxAEWAYN0GodwyglD39PjsZIYA/v8gNE 5zU7qn44rpOn3UBLSmQgjcRsOpTMW4/2ICa5hm8onm4BKbpLV+6jCAsWhUNxc7xcDZ45 5/cNtkUf78VoRx5/sO9F26dGTe/oWVjCpcfCn0bI4XLs01whZmZGjIAca51+PyqoP2pi xlOeTfu6V69hdMCr3xa90u1FIVnKDfDIltqlv4Qh2VN6GG5o9lSwOrZOUxBXEZK4pT8v 7xag== X-Gm-Message-State: AA+aEWa6/AeWArg48QXPyLRszwHVpeYlfVlpt2HPH4A+g2y7xPk6nWqQ RgJOLfGk9x1vfZMR7JX0zlLG4YvqgzTUANZVsIZUhGSSRxftPhk7hcfedyVZLBu7ZUlsBOVND7p HGji6WfwRiou/o8bu5dgzl+yo X-Received: by 2002:a24:458c:: with SMTP id c12mr11569001itd.27.1545789742140; Tue, 25 Dec 2018 18:02:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ya1K9/5xUS9pmmnfiH2yYHpdKeFYDhfZHwOkl6UmZpboMtWY3TO+w/6LLC4HAmQ3FjCxbIw== X-Received: by 2002:a24:458c:: with SMTP id c12mr11568995itd.27.1545789741892; Tue, 25 Dec 2018 18:02:21 -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 l11sm15744186iob.24.2018.12.25.18.02.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Dec 2018 18:02:20 -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] usb: chipidea: add a check for the availability of next child Date: Tue, 25 Dec 2018 20:01:34 -0600 Message-Id: <20181226020134.71351-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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 880009987460..7dc987b4036a 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -250,6 +250,8 @@ 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"); ci->hsic = of_device_is_compatible(phy_node, "qcom,usb-hsic-phy"); of_node_put(phy_node); }