From: Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
To: sudipm.mukherjee@gmail.com, jic23@kernel.org,
daniel.baluta@intel.com, dan.carpenter@oracle.com,
gregkh@linuxfoundation.org
Cc: cristina.opriceana@gmail.com,
driverdev-devel@linuxdriverproject.org,
linux-iio@vger.kernel.org,
Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
Subject: [PATCH v3 1/3] staging: iio_simple_dummy: fix init function
Date: Sat, 30 May 2015 11:20:15 +0300 [thread overview]
Message-ID: <1432974017-24547-2-git-send-email-rodriguez.twister@gmail.com> (raw)
In-Reply-To: <1432974017-24547-1-git-send-email-rodriguez.twister@gmail.com>
This patch fixes the init function for the iio_simple_dummy driver.
The main issues were absence of kfree for the allocated array, and no
devices being removed in case the probe function fails, running in a loop.
Signed-off-by: Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
---
drivers/staging/iio/iio_simple_dummy.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index b47bf9f..d0a9963 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -722,9 +722,16 @@ static __init int iio_dummy_init(void)
for (i = 0; i < instances; i++) {
ret = iio_dummy_probe(i);
if (ret < 0)
- return ret;
+ goto error_remove_devs;
}
return 0;
+
+error_remove_devs:
+ while (i--)
+ iio_dummy_remove(i);
+
+ kfree(iio_dummy_devs);
+ return ret;
}
module_init(iio_dummy_init);
--
2.4.1
next prev parent reply other threads:[~2015-05-30 8:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-30 8:20 [PATCH v3 0/3] staging: iio_simple_dummy: minor driver fixes Vladimirs Ambrosovs
2015-05-30 8:20 ` Vladimirs Ambrosovs [this message]
2015-06-01 10:21 ` [PATCH v3 1/3] staging: iio_simple_dummy: fix init function Jonathan Cameron
2015-05-30 8:20 ` [PATCH v3 2/3] staging: iio_simple_dummy: fix return types Vladimirs Ambrosovs
2015-06-01 10:21 ` Jonathan Cameron
2015-05-30 8:20 ` [PATCH v3 3/3] staging: iio_simple_dummy: fix module_param type Vladimirs Ambrosovs
2015-06-01 10:23 ` Jonathan Cameron
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=1432974017-24547-2-git-send-email-rodriguez.twister@gmail.com \
--to=rodriguez.twister@gmail.com \
--cc=cristina.opriceana@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=daniel.baluta@intel.com \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=sudipm.mukherjee@gmail.com \
/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).