soundwire: slave: don't init debugfs on device registration error
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Sun, 19 Apr 2020 18:51:15 +0000 (02:51 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 5 May 2020 03:21:44 +0000 (08:51 +0530)
The error handling flow seems incorrect, there is no reason to try and
add debugfs support if the device registration did not
succeed. Return on error.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200419185117.4233-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/slave.c

index aace57f..4bacdb1 100644 (file)
@@ -68,6 +68,8 @@ static int sdw_slave_add(struct sdw_bus *bus,
                list_del(&slave->node);
                mutex_unlock(&bus->bus_lock);
                put_device(&slave->dev);
+
+               return ret;
        }
        sdw_slave_debugfs_init(slave);