diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-04-25 13:51:51 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2020-05-11 21:23:16 +0200 |
commit | 3093c64101729e9b2b7be409abf3ebc4735f2b1e (patch) | |
tree | 9e91890a37b6e6daa094a9653ac1982d86be9d81 /drivers | |
parent | i2c: mux: pca954x: Make use of device properties (diff) | |
download | linux-3093c64101729e9b2b7be409abf3ebc4735f2b1e.tar.xz linux-3093c64101729e9b2b7be409abf3ebc4735f2b1e.zip |
i2c: mux: pca954x: Move device_remove_file() out of pca954x_cleanup()
device_create_file() is called the last in ->probe() but pca954x_cleanup(),
which is called earlier in error path, tries to remove never created file.
Move device_remove_file() call outside of pca954x_cleanup() to make it
slightly closer to what pca954x_init() is doing.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/muxes/i2c-mux-pca954x.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index 928c6f5ceac7..0908a0655cb7 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -383,11 +383,8 @@ static int pca954x_irq_setup(struct i2c_mux_core *muxc) static void pca954x_cleanup(struct i2c_mux_core *muxc) { struct pca954x *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; int c, irq; - device_remove_file(&client->dev, &dev_attr_idle_state); - if (data->irq) { for (c = 0; c < data->chip->nchans; c++) { irq = irq_find_mapping(data->irq, c); @@ -531,6 +528,8 @@ static int pca954x_remove(struct i2c_client *client) { struct i2c_mux_core *muxc = i2c_get_clientdata(client); + device_remove_file(&client->dev, &dev_attr_idle_state); + pca954x_cleanup(muxc); return 0; } |