mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 18:53:52 +08:00
9eb40fa2cd
of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. soc_is_tegra() doesn't do that, so fix it. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> [treding: slightly rewrite to avoid inline comparison] Signed-off-by: Thierry Reding <treding@nvidia.com>
37 lines
866 B
C
37 lines
866 B
C
/*
|
|
* Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#include <linux/of.h>
|
|
|
|
#include <soc/tegra/common.h>
|
|
|
|
static const struct of_device_id tegra_machine_match[] = {
|
|
{ .compatible = "nvidia,tegra20", },
|
|
{ .compatible = "nvidia,tegra30", },
|
|
{ .compatible = "nvidia,tegra114", },
|
|
{ .compatible = "nvidia,tegra124", },
|
|
{ .compatible = "nvidia,tegra132", },
|
|
{ .compatible = "nvidia,tegra210", },
|
|
{ }
|
|
};
|
|
|
|
bool soc_is_tegra(void)
|
|
{
|
|
const struct of_device_id *match;
|
|
struct device_node *root;
|
|
|
|
root = of_find_node_by_path("/");
|
|
if (!root)
|
|
return false;
|
|
|
|
match = of_match_node(tegra_machine_match, root);
|
|
of_node_put(root);
|
|
|
|
return match != NULL;
|
|
}
|