1. 16 8月, 2016 1 次提交
  2. 13 8月, 2016 1 次提交
    • K
      of/platform: disable the of_platform_default_populate_init() for all the ppc boards · fc520f8b
      Kevin Hao 提交于
      With the commit 44a7185c ("of/platform: Add common method to
      populate default bus"), a default function is introduced to populate
      the default bus and this function is invoked at the arch_initcall_sync
      level. But a lot of ppc boards use machine_device_initcall() to
      populate the default bus. This means that the default populate function
      has higher priority and would override the arch specific population of
      the bus. The side effect is that some arch specific bus are not probed,
      then cause various malfunction due to the miss of some devices. Since
      it is very possible to introduce bugs if we simply change the initcall
      level for all these boards(about 30+). This just disable this default
      function for all the ppc boards.
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      fc520f8b
  3. 10 8月, 2016 3 次提交
    • P
      of/irq: Mark interrupt controllers as populated before initialisation · e55aeb6b
      Philipp Zabel 提交于
      That way the init callback may clear the flag again, in case of drivers
      split between early irq chip and a normal platform driver.
      
      Fixes: 15cc2ed6 ("of/irq: Mark initialised interrupt controllers as populated")
      Suggested-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NPhilipp Zabel <p.zabel@pengutronix.de>
      Acked-by: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      e55aeb6b
    • G
      drivers/of: Validate device node in __unflatten_device_tree() · 89c67752
      Gavin Shan 提交于
      @mynodes is set to NULL when __unflatten_device_tree() is called
      to unflatten device sub-tree in PCI hot add scenario on PowerPC
      PowerNV platform. Marking @mynodes detached unconditionally causes
      kernel crash as below backtrace shows:
      
      Unable to handle kernel paging request for data at address 0x00000000
      Faulting instruction address: 0xc000000000b26f64
      cpu 0x0: Vector: 300 (Data Access) at [c000003fcc7cf740]
          pc: c000000000b26f64: __unflatten_device_tree+0xf4/0x190
          lr: c000000000b26f40: __unflatten_device_tree+0xd0/0x190
          sp: c000003fcc7cf9c0
         msr: 900000000280b033
         dar: 0
       dsisr: 40000000
        current = 0xc000003fcc281680
        paca    = 0xc00000000ff00000	 softe: 0	 irq_happened: 0x01
          pid   = 2724, comm = sh
      Linux version 4.7.0-gavin-07754-g92a6836 (gwshan@gwshan) (gcc version \
      4.9.3 (Buildroot 2016.02-rc2-00093-g5ea3bce) ) #539 SMP Mon Aug 1 \
      12:40:29 AEST 2016
      enter ? for help
      [c000003fcc7cfa50] c000000000b27060 of_fdt_unflatten_tree+0x60/0x90
      [c000003fcc7cfaa0] c0000000004c6288 pnv_php_set_slot_power_state+0x118/0x440
      [c000003fcc7cfb80] c0000000004c6a10 pnv_php_enable+0xc0/0x170
      [c000003fcc7cfbd0] c0000000004c4d80 power_write_file+0xa0/0x190
      [c000003fcc7cfc50] c0000000004be93c pci_slot_attr_store+0x3c/0x60
      [c000003fcc7cfc70] c0000000002d3fd4 sysfs_kf_write+0x94/0xc0
      [c000003fcc7cfcb0] c0000000002d2c30 kernfs_fop_write+0x180/0x260
      [c000003fcc7cfd00] c000000000230fe0 __vfs_write+0x40/0x190
      [c000003fcc7cfd90] c000000000232278 vfs_write+0xc8/0x240
      [c000003fcc7cfde0] c000000000233d90 SyS_write+0x60/0x110
      [c000003fcc7cfe30] c000000000009524 system_call+0x38/0x108
      
      This avoids the kernel crash by marking @mynodes detached only when
      @mynodes is dereferencing valid device node in __unflatten_device_tree().
      
      Fixes: 1d1bde55 ("of: fdt: mark unflattened tree as detached")
      Reported-by: NMeng Li <shlimeng@cn.ibm.com>
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      89c67752
    • M
      of: Delete an unnecessary check before the function call "of_node_put" · beab47d5
      Markus Elfring 提交于
      The of_node_put() function tests whether its argument is NULL
      and then returns immediately.
      Thus the test around the call is not needed.
      
      This issue was detected by using the Coccinelle software.
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NRob Herring <robh@kernel.org>
      beab47d5
  4. 06 8月, 2016 1 次提交
  5. 20 7月, 2016 1 次提交
  6. 19 7月, 2016 3 次提交
  7. 17 7月, 2016 1 次提交
  8. 06 7月, 2016 1 次提交
  9. 28 6月, 2016 1 次提交
    • A
      of_mdio: select fixed phy support unconditionally · a5e4bd99
      Arnd Bergmann 提交于
      Calling the fixed-phy functions when CONFIG_FIXED_PHY=m as a previous
      change tried cannot work if the caller is in built-in code:
      
      drivers/of/built-in.o: In function `of_phy_register_fixed_link':
      of_reserved_mem.c:(.text+0x85e0): undefined reference to `fixed_phy_register'
      
      Making of_mdio depend on 'FIXED_PHY || !FIXED_PHY' would solve this
      dependency by enforcing that OF_MDIO itself becomes a loadable module
      when FIXED_PHY=y, but that creates a different dependency as it
      breaks any built-in ethernet driver that uses of_mdio.
      
      Making FIXED_PHY a bool option also cannot work, since it depends on
      PHYLIB, which again is tristate.
      
      This version now uses 'select FIXED_PHY' to ensure that the fixed-phy
      portion of of_mdio is not optional. The main downside of this is
      a small increase in code size for cases that do not need fixed phy
      support, but it should avoid all of the link-time problems.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Fixes: d1bd330a ("of_mdio: Enable fixed PHY support if driver is a module")
      Acked-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a5e4bd99
  10. 25 6月, 2016 2 次提交
    • J
      of/irq: Mark initialised interrupt controllers as populated · 15cc2ed6
      Jon Hunter 提交于
      For interrupt controllers successfully initialised early via device-tree,
      mark these interrupt controllers as populated so we don't unnecessarily
      create a device and populate any platform data later on in the boot
      sequence when we populate all the various platform devices.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      15cc2ed6
    • F
      of: fix memory leak related to safe_name() · d9fc8807
      Frank Rowand 提交于
      Fix a memory leak resulting from memory allocation in safe_name().
      This patch fixes all call sites of safe_name().
      
      Mathieu Malaterre reported the memory leak on boot:
      
      On my PowerMac device-tree would generate a duplicate name:
      
      [    0.023043] device-tree: Duplicate name in PowerPC,G4@0, renamed to "l2-cache#1"
      
      in this case a newly allocated name is generated by `safe_name`. However
      in this case it is never deallocated.
      
      The bug was found using kmemleak reported as:
      
      unreferenced object 0xdf532e60 (size 32):
        comm "swapper", pid 1, jiffies 4294892300 (age 1993.532s)
        hex dump (first 32 bytes):
          6c 32 2d 63 61 63 68 65 23 31 00 dd e4 dd 1e c2  l2-cache#1......
          ec d4 ba ce 04 ec cc de 8e 85 e9 ca c4 ec cc 9e  ................
        backtrace:
          [<c02d3350>] kvasprintf+0x64/0xc8
          [<c02d3400>] kasprintf+0x4c/0x5c
          [<c0453814>] safe_name.isra.1+0x80/0xc4
          [<c04545d8>] __of_attach_node_sysfs+0x6c/0x11c
          [<c075f21c>] of_core_init+0x8c/0xf8
          [<c0729594>] kernel_init_freeable+0xd4/0x208
          [<c00047e8>] kernel_init+0x24/0x11c
          [<c00158ec>] ret_from_kernel_thread+0x5c/0x64
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=120331Signed-off-by: NFrank Rowand <frank.rowand@am.sony.com>
      Reported-by: mathieu.malaterre@gmail.com
      Tested-by: NMathieu Malaterre <mathieu.malaterre@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NRob Herring <robh@kernel.org>
      d9fc8807
  11. 24 6月, 2016 4 次提交
  12. 10 6月, 2016 1 次提交
  13. 09 6月, 2016 1 次提交
  14. 03 6月, 2016 4 次提交
  15. 30 5月, 2016 1 次提交
  16. 19 5月, 2016 3 次提交
    • J
      of/unittest: Remove unnecessary module.h header inclusion · 27f4ec14
      Javier Martinez Canillas 提交于
      The OF_UNITTEST Kconfig symbol is bool so this unittest can only be
      built-in and not build as a module. Also, nothing defined in this
      header file used so is not necessary to include it.
      Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      27f4ec14
    • G
      drivers/of: Fix build warning in populate_node() · dddc33e5
      Gavin Shan 提交于
      Function populate_node() is used to unflatten FDT blob to device
      tree. It supports maximal 64 level of device nodes. There is one
      array @fpsizes[64] tracking the full name length of last unflattened
      device node in the corresponding level (index of element in the
      array - 1). Build warning is seen with CONFIG_FRAME_WARN=1024 like
      below on ARM64 as Geert reported. The issue can be reproduced on
      PPC64 as well.
      
        $ make drivers/of/fdt.o
        drivers/of/fdt.c:443:1: warning: the frame size of 1136 bytes is \
        larger than 1024 bytes [-Wframe-larger-than=]
      
      This changes the data type of @fpsizes[i] from "unsigned long" to
      "unsigned int" to avoid the build warning. The return value type
      of populate_node() and its @fpsize argument is adjusted accordingly.
      With this applied, 256 bytes saved from the stack frame on ARM64 and
      PPC64 platforms and the above warning isn't seen.
      
      Fixes: 50800082 ("drivers/of: Avoid recursively calling unflatten_dt_node()")
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      dddc33e5
    • R
      drivers/of: Fix depth when unflattening devicetree · 78c44d91
      Rhyland Klein 提交于
      When the implementation for unflatten_dt_node() changed from being
      recursive to being non-recursive, it had a side effect of increasing the
      depth passed to fdt_next_node() by 1. This is fine most of the time, but
      it seems that when the end of the dtb is being parsed, it will cause the
      FDT_END condition in fdt_next_node() to return a different value
      (returning nextoffset instead of -FDT_ERR_NOTFOUND). This ends up passing
      an FDT_ERR_TRUNCATED error back to the unflatten_dt_node() which then
      sees that and complains "Error -8 processing FDT" causing boot to fail.
      
      This patch simply avoids incrementing depth and uses modified accesses
      for local array indices so that the depth is the same as it was before
      the change as far as fdt_next_node() is concerned.
      
      This problem was discovered trying to boot Tegra210-Smaug platforms.
      
      Fixes: 50800082 ("drivers/of: Avoid recursively calling unflatten_dt_node()")
      Signed-off-by: NRhyland Klein <rklein@nvidia.com>
      [robh: squashed in KASAN fix from Rhyland]
      Signed-off-by: NRob Herring <robh@kernel.org>
      78c44d91
  17. 16 5月, 2016 7 次提交
  18. 12 5月, 2016 1 次提交
  19. 11 5月, 2016 1 次提交
    • S
      drivers/of: Add check for null property in of_remove_property() · 201b3fe5
      Suraj Jitindar Singh 提交于
      The validity of the property input argument to of_remove_property() is
      never checked within the function and thus it is possible to pass a null
      value. It happens that this will be picked up in __of_remove_property()
      as no matching property of the device node will be found and thus an
      error will be returned, however once again there is no explicit check
      for a null value. By the time this is detected 2 locks have already been
      acquired which is completely unnecessary if the property to remove is
      null.
      
      Add an explicit check in the function of_remove_property() for a null
      property value and return -ENODEV in this case, this is consistent with
      what the previous return value would have been when the null value was
      not detected and passed to __of_remove_property().
      
      By moving an explicit check for the property paramenter into the
      of_remove_property() function, this will remove the need to perform this
      check in calling code before invocation of the of_remove_property()
      function.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      201b3fe5
  20. 09 5月, 2016 1 次提交
  21. 06 5月, 2016 1 次提交