• Jeremy Kerr's avatar
    fsi/core: Fix error paths on CFAM init · 371975b0
    Jeremy Kerr authored
    Change d1dcd678 re-worked the struct fsi_slave initialisation in
    fsi_slave_init, but introduced a few inconsitencies: the slave->dev is
    now registered through cdev_device_add, but we may kfree() the device
    out from underneath the cdev registration. We may also leave an IDA
    allocated.
    
    This change fixes the error paths, so that we kfree() only before the
    device is registered with the core code. We also move the smode write to
    before we start creating proper devices, as it's the most likely to
    fail. We also remove the IDA-allocated minor on error, and properly
    clean up the of_node.
    
    Fixes: d1dcd678 ("fsi: Add cfam char devices")
    Reported-by: default avatarLei YU <mine260309@gmail.com>
    Tested-by: default avatarJohn Wang <wangzqbj@inspur.com>
    Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
    Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
    371975b0
fsi-core.c 31.4 KB