lkml.org 
[lkml]   [2018]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 042/328] ARM: hisi: handle of_iomap and fix missing of_node_put
    3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Nicholas Mc Guire <hofrat@osadl.org>

    commit d396cb185c0337aae5664b250cdd9a73f6eb1503 upstream.

    Relying on an unchecked of_iomap() which can return NULL is problematic
    here, an explicit check seems mandatory. Also the call to
    of_find_compatible_node() returns a device node with refcount incremented
    therefor an explicit of_node_put() is needed here.

    Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
    Fixes: commit 22bae4290457 ("ARM: hi3xxx: add hotplug support")
    Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    arch/arm/mach-hisi/hotplug.c | 19 +++++++++++++------
    1 file changed, 13 insertions(+), 6 deletions(-)

    --- a/arch/arm/mach-hisi/hotplug.c
    +++ b/arch/arm/mach-hisi/hotplug.c
    @@ -137,13 +137,20 @@ static int hi3xxx_hotplug_init(void)
    struct device_node *node;

    node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
    - if (node) {
    - ctrl_base = of_iomap(node, 0);
    - id = HI3620_CTRL;
    - return 0;
    + if (!node) {
    + id = ERROR_CTRL;
    + return -ENOENT;
    }
    - id = ERROR_CTRL;
    - return -ENOENT;
    +
    + ctrl_base = of_iomap(node, 0);
    + of_node_put(node);
    + if (!ctrl_base) {
    + id = ERROR_CTRL;
    + return -ENOMEM;
    + }
    +
    + id = HI3620_CTRL;
    + return 0;
    }

    void hi3xxx_set_cpu(int cpu, bool enable)
    \
     
     \ /
      Last update: 2018-12-09 23:17    [W:4.065 / U:0.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site