diff options
author | Sean Paul <seanpaul@chromium.org> | 2017-09-20 17:13:56 -0700 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2017-09-21 13:05:35 -0700 |
commit | 6bf2e0324b9376512b0b9bf5c5c4b383afd419ec (patch) | |
tree | 3334347fa7c1de3508b86933fd2cb26c96d7bcd1 /drivers/gpu/drm/rockchip/rockchip_lvds.c | |
parent | 531beb067c6185aceabfdee0965234c6a8fd133b (diff) | |
download | linux-6bf2e0324b9376512b0b9bf5c5c4b383afd419ec.tar.bz2 |
drm/rockchip: Fix uninitialized use of ret
If there are no children for lvds, ret is used uninitialized. This patch
initializes ret and returns an error if the port has no children.
Fixes: 34cc0aa25456 ("drm/rockchip: Add support for Rockchip Soc LVDS")
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Reviewed-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20170921001408.1839-1-seanpaul@chromium.org
Diffstat (limited to 'drivers/gpu/drm/rockchip/rockchip_lvds.c')
-rw-r--r-- | drivers/gpu/drm/rockchip/rockchip_lvds.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c index c5fbe533796c..84911bdc27d1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c @@ -346,7 +346,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, struct drm_connector *connector; struct device_node *remote = NULL; struct device_node *port, *endpoint; - int ret; + int ret = 0, child_count = 0; const char *name; u32 endpoint_id; @@ -358,15 +358,20 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, return -EINVAL; } for_each_child_of_node(port, endpoint) { + child_count++; of_property_read_u32(endpoint, "reg", &endpoint_id); ret = drm_of_find_panel_or_bridge(dev->of_node, 1, endpoint_id, &lvds->panel, &lvds->bridge); if (!ret) break; } - if (ret) { + if (!child_count) { + DRM_DEV_ERROR(dev, "lvds port does not have any children\n"); + ret = -EINVAL; + goto err_put_port; + } else if (ret) { DRM_DEV_ERROR(dev, "failed to find panel and bridge node\n"); - ret = -EPROBE_DEFER; + ret = -EPROBE_DEFER; goto err_put_port; } if (lvds->panel) |