From: Markus Franke <markus.franke@s2002.tu-chemnitz.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Markus Franke <markus.franke@s2002.tu-chemnitz.de>,
Greg KH <greg@kroah.com>, Evgeniy Polyakov <zbr@ioremap.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] w1: Add 1-wire slave device driver for DS28E04-100
Date: Fri, 11 May 2012 08:15:32 +0200 [thread overview]
Message-ID: <4FACAE84.6080501@hrz.tu-chemnitz.de> (raw)
In-Reply-To: <20120510162227.5cf2294b.akpm@linux-foundation.org>
Dear Andrew,
thanks for the feedback.
Am 11.05.2012 01:22, schrieb Andrew Morton:
> On Fri, 11 May 2012 00:57:58 +0200
> Markus Franke <markus.franke@s2002.tu-chemnitz.de> wrote:
>
>> +static int w1_f1C_add_slave(struct w1_slave *sl)
>> +{
>> + int err = 0;
>> + int i;
>> + struct w1_f1C_data *data = NULL;
>> +
>> + if (w1_enable_crccheck) {
>> + data = kzalloc(sizeof(struct w1_f1C_data), GFP_KERNEL);
>> + if (!data)
>> + return -ENOMEM;
>> + sl->family_data = data;
>> + }
>> +
>> + /* create binary sysfs attributes */
>> + for (i = 0; i < NB_SYSFS_BIN_FILES && !err; ++i)
>> + err = sysfs_create_bin_file(
>> + &sl->dev.kobj, &(w1_f1C_bin_attr[i]));
>> +
>> + if (err)
>> + goto out;
>
> If this goto is taken, we will leak 0..i sysfs files.
That's indeed the case. :-(
>> + /* create device attributes */
>> + err = device_create_file(&sl->dev, &dev_attr_crccheck);
>> +
>> + if (err) {
>> + /* remove binary sysfs attributes */
>> + for (i = 0; i < NB_SYSFS_BIN_FILES; ++i)
>> + sysfs_remove_bin_file(
>> + &sl->dev.kobj, &(w1_f1C_bin_attr[i]));
>> + }
>> +
>> +out:
>> + if (err) {
>> + if (w1_enable_crccheck)
>> + kfree(data);
>
> kfree(NULL) is legal - the w1_enable_crccheck test can be removed.
Ok, I'll fix this for the next (hopefully final) version of the patch.
Best regards,
Markus Franke
prev parent reply other threads:[~2012-05-11 6:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 2:13 [PATCH] w1: Add 1-wire slave device driver for DS28E04-100 Greg KH
2012-05-02 20:12 ` Markus Franke
2012-05-02 20:21 ` Greg KH
2012-05-03 18:00 ` Evgeniy Polyakov
2012-05-09 20:37 ` Markus Franke
2012-05-09 22:06 ` Greg KH
2012-05-09 22:16 ` Markus Franke
2012-05-09 22:24 ` Greg KH
2012-05-09 22:37 ` Markus Franke
2012-05-09 23:57 ` Evgeniy Polyakov
2012-05-10 0:01 ` Greg KH
2012-05-10 0:43 ` Evgeniy Polyakov
2012-05-10 3:43 ` Greg KH
2012-05-10 4:55 ` Markus Franke
2012-05-10 15:16 ` Greg KH
2012-05-10 22:57 ` Markus Franke
2012-05-10 23:04 ` Greg KH
2012-05-11 6:13 ` Markus Franke
2012-05-15 1:21 ` Evgeniy Polyakov
2012-05-25 22:45 ` Markus Franke
2012-05-10 23:22 ` Andrew Morton
2012-05-11 6:15 ` Markus Franke [this message]
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=4FACAE84.6080501@hrz.tu-chemnitz.de \
--to=markus.franke@s2002.tu-chemnitz.de \
--cc=akpm@linux-foundation.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zbr@ioremap.net \
/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