From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Peter Rosin <peda@axentia.se>,
linux-i2c@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v3 3/4] i2c: mux: pca954x: Move device_remove_file() out of pca954x_cleanup()
Date: Sat, 25 Apr 2020 14:51:51 +0300 [thread overview]
Message-ID: <20200425115152.29475-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20200425115152.29475-1-andriy.shevchenko@linux.intel.com>
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>
---
v3: rebase on top of latest rc
drivers/i2c/muxes/i2c-mux-pca954x.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 928c6f5ceac70..0908a0655cb79 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;
}
--
2.26.2
next prev parent reply other threads:[~2020-04-25 11:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-25 11:51 [PATCH v3 1/4] i2c: mux: pca954x: Refactor pca954x_irq_handler() Andy Shevchenko
2020-04-25 11:51 ` [PATCH v3 2/4] i2c: mux: pca954x: Make use of device properties Andy Shevchenko
2020-05-06 16:09 ` Peter Rosin
2020-04-25 11:51 ` Andy Shevchenko [this message]
2020-05-06 16:10 ` [PATCH v3 3/4] i2c: mux: pca954x: Move device_remove_file() out of pca954x_cleanup() Peter Rosin
2020-04-25 11:51 ` [PATCH v3 4/4] i2c: mux: pca954x: Convert license to SPDX identifier Andy Shevchenko
2020-05-06 16:10 ` Peter Rosin
2020-05-06 12:42 ` [PATCH v3 1/4] i2c: mux: pca954x: Refactor pca954x_irq_handler() Andy Shevchenko
2020-05-06 13:19 ` Peter Rosin
2020-05-06 15:45 ` Wolfram Sang
2020-05-06 16:06 ` Andy Shevchenko
2020-05-06 16:09 ` Peter Rosin
2020-05-11 19:26 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200425115152.29475-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-i2c@vger.kernel.org \
--cc=peda@axentia.se \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).