Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756200AbbBHPYf (ORCPT ); Sun, 8 Feb 2015 10:24:35 -0500 Received: from mail-we0-f173.google.com ([74.125.82.173]:40520 "EHLO mail-we0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635AbbBHPYd (ORCPT ); Sun, 8 Feb 2015 10:24:33 -0500 From: David Dueck To: linux-kernel@vger.kernel.org Cc: bigeasy@linutronix.de, balbi@ti.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org Subject: [PATCH] usb: phy: am335x-control: check return value of bus_find_device Date: Sun, 8 Feb 2015 16:29:30 +0100 Message-Id: <1423409370-4769-1-git-send-email-davidcdueck@googlemail.com> X-Mailer: git-send-email 2.2.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 914 Lines: 29 This fixes a potential null pointer dereference. Signed-off-by: David Dueck --- drivers/usb/phy/phy-am335x-control.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index 403fab7..7b3035f 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c @@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev) return NULL; dev = bus_find_device(&platform_bus_type, NULL, node, match); + if (!dev) + return NULL; + ctrl_usb = dev_get_drvdata(dev); if (!ctrl_usb) return NULL; -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/