* Re: [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes()
[not found] <166070137.57941.1406779444750.JavaMail.root@mx2.compro.net>
@ 2014-07-31 12:44 ` Mark Hounschell
2014-07-31 23:14 ` DaeSeok Youn
[not found] ` <1598413764.80217.1406848485858.JavaMail.root@mx2.compro.net>
0 siblings, 2 replies; 7+ messages in thread
From: Mark Hounschell @ 2014-07-31 12:44 UTC (permalink / raw)
To: Daeseok Youn, lidza.louina
Cc: gregkh, driverdev-devel, devel, linux-kernel, dan.carpenter
On 07/31/2014 12:02 AM, Daeseok Youn wrote:
> When a configration file is parsed with dgap_parsefile(),
> makes nodes for saving configrations for board.
>
> Making a node will allocate node memory and strings for saving
> configrations with kstrdup().
>
> So these are freed when dgap is unloaded or failed to initialize.
>
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---
> V2: Do not need to free for NULLNODE.
>
> I have been too busy to solve this issue, sorry for late.
>
> Mark, Can you test this patch? I try to make simple module which is
> testing dgap_parsefile() and dgap_cleanup_nodes().
>
I'll be happy to, but I can't do it until Monday. I'm not where the
hardware is until then.
Regards
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes()
2014-07-31 12:44 ` [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes() Mark Hounschell
@ 2014-07-31 23:14 ` DaeSeok Youn
[not found] ` <1598413764.80217.1406848485858.JavaMail.root@mx2.compro.net>
1 sibling, 0 replies; 7+ messages in thread
From: DaeSeok Youn @ 2014-07-31 23:14 UTC (permalink / raw)
To: Mark Hounschell
Cc: Lidza Louina, Greg KH, driverdev-devel, devel, linux-kernel,
Dan Carpenter
Hi, Mark
2014-07-31 21:44 GMT+09:00 Mark Hounschell <markh@compro.net>:
> On 07/31/2014 12:02 AM, Daeseok Youn wrote:
>>
>> When a configration file is parsed with dgap_parsefile(),
>> makes nodes for saving configrations for board.
>>
>> Making a node will allocate node memory and strings for saving
>> configrations with kstrdup().
>>
>> So these are freed when dgap is unloaded or failed to initialize.
>>
>> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
>> ---
>> V2: Do not need to free for NULLNODE.
>>
>> I have been too busy to solve this issue, sorry for late.
>>
>> Mark, Can you test this patch? I try to make simple module which is
>> testing dgap_parsefile() and dgap_cleanup_nodes().
>>
>
> I'll be happy to, but I can't do it until Monday. I'm not where the hardware
> is until then.
That's OK. :-)
Thanks.
Daeseok Youn.
>
> Regards
> Mark
>
^ permalink raw reply [flat|nested] 7+ messages in thread[parent not found: <1598413764.80217.1406848485858.JavaMail.root@mx2.compro.net>]
* Re: [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes()
[not found] ` <1598413764.80217.1406848485858.JavaMail.root@mx2.compro.net>
@ 2014-08-04 12:40 ` Mark Hounschell
2014-08-04 23:33 ` DaeSeok Youn
0 siblings, 1 reply; 7+ messages in thread
From: Mark Hounschell @ 2014-08-04 12:40 UTC (permalink / raw)
To: DaeSeok Youn
Cc: Lidza Louina, Greg KH, driverdev-devel, devel, linux-kernel,
Dan Carpenter
On 07/31/2014 07:14 PM, DaeSeok Youn wrote:
> Hi, Mark
>
> 2014-07-31 21:44 GMT+09:00 Mark Hounschell <markh@compro.net>:
>> On 07/31/2014 12:02 AM, Daeseok Youn wrote:
>>>
>>> When a configration file is parsed with dgap_parsefile(),
>>> makes nodes for saving configrations for board.
>>>
>>> Making a node will allocate node memory and strings for saving
>>> configrations with kstrdup().
>>>
>>> So these are freed when dgap is unloaded or failed to initialize.
>>>
>>> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
>>> ---
>>> V2: Do not need to free for NULLNODE.
>>>
>>> I have been too busy to solve this issue, sorry for late.
>>>
>>> Mark, Can you test this patch? I try to make simple module which is
>>> testing dgap_parsefile() and dgap_cleanup_nodes().
>>>
>>
>> I'll be happy to, but I can't do it until Monday. I'm not where the hardware
>> is until then.
> That's OK. :-)
>
After applying this patch I am still able to load and unload the driver
at will, and it still works for me.
Regards
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes()
2014-08-04 12:40 ` Mark Hounschell
@ 2014-08-04 23:33 ` DaeSeok Youn
2014-08-04 23:38 ` Greg KH
0 siblings, 1 reply; 7+ messages in thread
From: DaeSeok Youn @ 2014-08-04 23:33 UTC (permalink / raw)
To: Mark Hounschell, Greg KH
Cc: Lidza Louina, driverdev-devel, devel, linux-kernel, Dan Carpenter
Hi, Mark and Greg.
Thanks for testing. :-)
Greg, is this patch possible to merge to your staging tree?
Please check for me.
patch : https://lkml.org/lkml/2014/7/31/2
Thanks.
regards,
Daeseok Youn.
2014-08-04 21:40 GMT+09:00 Mark Hounschell <markh@compro.net>:
> On 07/31/2014 07:14 PM, DaeSeok Youn wrote:
>>
>> Hi, Mark
>>
>> 2014-07-31 21:44 GMT+09:00 Mark Hounschell <markh@compro.net>:
>>>
>>> On 07/31/2014 12:02 AM, Daeseok Youn wrote:
>>>
>>>>
>>>> When a configration file is parsed with dgap_parsefile(),
>>>> makes nodes for saving configrations for board.
>>>>
>>>> Making a node will allocate node memory and strings for saving
>>>> configrations with kstrdup().
>>>>
>>>> So these are freed when dgap is unloaded or failed to initialize.
>>>>
>>>> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
>>>> ---
>>>> V2: Do not need to free for NULLNODE.
>>>>
>>>> I have been too busy to solve this issue, sorry for late.
>>>>
>>>> Mark, Can you test this patch? I try to make simple module which is
>>>> testing dgap_parsefile() and dgap_cleanup_nodes().
>>>>
>>>
>>> I'll be happy to, but I can't do it until Monday. I'm not where the
>>> hardware
>>> is until then.
>>
>> That's OK. :-)
>>
>
> After applying this patch I am still able to load and unload the driver at
> will, and it still works for me.
>
> Regards
> Mark
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes()
2014-08-04 23:33 ` DaeSeok Youn
@ 2014-08-04 23:38 ` Greg KH
2014-08-05 0:48 ` DaeSeok Youn
0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2014-08-04 23:38 UTC (permalink / raw)
To: DaeSeok Youn
Cc: Mark Hounschell, devel, Lidza Louina, driverdev-devel,
linux-kernel, Dan Carpenter
On Tue, Aug 05, 2014 at 08:33:16AM +0900, DaeSeok Youn wrote:
> Hi, Mark and Greg.
>
> Thanks for testing. :-)
>
> Greg, is this patch possible to merge to your staging tree?
> Please check for me.
> patch : https://lkml.org/lkml/2014/7/31/2
It's the middle of the merge window, I can't do anything until after
3.17-rc1 is out. So wait until then, I'll pick up the patch at that
point in time, it's still in my "to-apply" queue.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes()
2014-08-04 23:38 ` Greg KH
@ 2014-08-05 0:48 ` DaeSeok Youn
0 siblings, 0 replies; 7+ messages in thread
From: DaeSeok Youn @ 2014-08-05 0:48 UTC (permalink / raw)
To: Greg KH
Cc: Mark Hounschell, devel, Lidza Louina, driverdev-devel,
linux-kernel, Dan Carpenter
2014-08-05 8:38 GMT+09:00 Greg KH <gregkh@linuxfoundation.org>:
> On Tue, Aug 05, 2014 at 08:33:16AM +0900, DaeSeok Youn wrote:
>> Hi, Mark and Greg.
>>
>> Thanks for testing. :-)
>>
>> Greg, is this patch possible to merge to your staging tree?
>> Please check for me.
>> patch : https://lkml.org/lkml/2014/7/31/2
>
> It's the middle of the merge window, I can't do anything until after
> 3.17-rc1 is out. So wait until then, I'll pick up the patch at that
> point in time, it's still in my "to-apply" queue.
OK. I will wait until then.
Thanks.
regards,
Daeseok Youn
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes()
@ 2014-07-31 4:02 Daeseok Youn
0 siblings, 0 replies; 7+ messages in thread
From: Daeseok Youn @ 2014-07-31 4:02 UTC (permalink / raw)
To: lidza.louina, markh
Cc: markh, daeseok.youn, gregkh, driverdev-devel, devel, linux-kernel,
dan.carpenter
When a configration file is parsed with dgap_parsefile(),
makes nodes for saving configrations for board.
Making a node will allocate node memory and strings for saving
configrations with kstrdup().
So these are freed when dgap is unloaded or failed to initialize.
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
V2: Do not need to free for NULLNODE.
I have been too busy to solve this issue, sorry for late.
Mark, Can you test this patch? I try to make simple module which is
testing dgap_parsefile() and dgap_cleanup_nodes().
There was a problem in freeing NULLNODE so if node is NULLNODE,
just bypass and get next one.
drivers/staging/dgap/dgap.c | 52 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 06c55cb..ac12e99 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -201,6 +201,7 @@ static int dgap_test_fep(struct board_t *brd);
static int dgap_tty_register_ports(struct board_t *brd);
static int dgap_firmware_load(struct pci_dev *pdev, int card_type,
struct board_t *brd);
+static void dgap_cleanup_nodes(void);
static void dgap_cleanup_module(void);
@@ -619,6 +620,7 @@ unregister_tty:
free_flipbuf:
dgap_free_flipbuf(brd);
cleanup_brd:
+ dgap_cleanup_nodes();
dgap_release_remap(brd);
kfree(brd);
@@ -659,6 +661,8 @@ static void dgap_cleanup_module(void)
dgap_cleanup_board(dgap_board[i]);
}
+ dgap_cleanup_nodes();
+
if (dgap_numboards)
pci_unregister_driver(&dgap_driver);
}
@@ -6323,6 +6327,54 @@ static void dgap_remove_tty_sysfs(struct device *c)
sysfs_remove_group(&c->kobj, &dgap_tty_attribute_group);
}
+static void dgap_cleanup_nodes(void)
+{
+ struct cnode *p;
+
+ p = &dgap_head;
+
+ while (p) {
+ struct cnode *tmp = p->next;
+
+ if (p->type == NULLNODE) {
+ p = tmp;
+ continue;
+ }
+
+ switch (p->type) {
+ case BNODE:
+ kfree(p->u.board.portstr);
+ kfree(p->u.board.addrstr);
+ kfree(p->u.board.pcibusstr);
+ kfree(p->u.board.pcislotstr);
+ kfree(p->u.board.method);
+ break;
+ case CNODE:
+ kfree(p->u.conc.id);
+ kfree(p->u.conc.connect);
+ break;
+ case MNODE:
+ kfree(p->u.module.id);
+ break;
+ case TNODE:
+ kfree(p->u.ttyname);
+ break;
+ case CUNODE:
+ kfree(p->u.cuname);
+ break;
+ case LNODE:
+ kfree(p->u.line.cable);
+ break;
+ case PNODE:
+ kfree(p->u.printname);
+ break;
+ }
+
+ kfree(p->u.board.status);
+ kfree(p);
+ p = tmp;
+ }
+}
/*
* Parse a configuration file read into memory as a string.
*/
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-08-05 0:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <166070137.57941.1406779444750.JavaMail.root@mx2.compro.net>
2014-07-31 12:44 ` [PATCH V2] staging: dgap: introduce dgap_cleanup_nodes() Mark Hounschell
2014-07-31 23:14 ` DaeSeok Youn
[not found] ` <1598413764.80217.1406848485858.JavaMail.root@mx2.compro.net>
2014-08-04 12:40 ` Mark Hounschell
2014-08-04 23:33 ` DaeSeok Youn
2014-08-04 23:38 ` Greg KH
2014-08-05 0:48 ` DaeSeok Youn
2014-07-31 4:02 Daeseok Youn
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).