Re: [PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Mark Brown
On Thu, Mar 13, 2014 at 09:06:01AM +0100, Krzysztof Kozlowski wrote: > After setting the 'data' pointer (wchich is returned to the caller for > freeing later) the regmap_add_irq_chip() could still fail for various > reasons (ENOMEM, regmap_read or regmap_write failure). In such case the > memory

Re: [PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Mark Brown
On Thu, Mar 13, 2014 at 03:33:04PM +0100, Krzysztof Kozlowski wrote: > Yes, you're right but still I think that 'data' should be set in a > atomic way - only if regmap_add_irq_chip() succeeds. Usually a caller > passing a pointer for allocation expects that one of: > 1. Allocation succeeds and it

Re: [PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Krzysztof Kozlowski
On Thu, 2014-03-13 at 14:13 +, Mark Brown wrote: > On Thu, Mar 13, 2014 at 09:06:01AM +0100, Krzysztof Kozlowski wrote: > > After setting the 'data' pointer (wchich is returned to the caller for > > freeing later) the regmap_add_irq_chip() could still fail for various > > reasons (ENOMEM,

Re: [PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Mark Brown
On Thu, Mar 13, 2014 at 09:06:01AM +0100, Krzysztof Kozlowski wrote: > After setting the 'data' pointer (wchich is returned to the caller for > freeing later) the regmap_add_irq_chip() could still fail for various > reasons (ENOMEM, regmap_read or regmap_write failure). In such case the > memory

[PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Krzysztof Kozlowski
After setting the 'data' pointer (wchich is returned to the caller for freeing later) the regmap_add_irq_chip() could still fail for various reasons (ENOMEM, regmap_read or regmap_write failure). In such case the memory under 'data' was freed in error path and error value was returned but the

[PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Krzysztof Kozlowski
After setting the 'data' pointer (wchich is returned to the caller for freeing later) the regmap_add_irq_chip() could still fail for various reasons (ENOMEM, regmap_read or regmap_write failure). In such case the memory under 'data' was freed in error path and error value was returned but the

Re: [PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Mark Brown
On Thu, Mar 13, 2014 at 09:06:01AM +0100, Krzysztof Kozlowski wrote: After setting the 'data' pointer (wchich is returned to the caller for freeing later) the regmap_add_irq_chip() could still fail for various reasons (ENOMEM, regmap_read or regmap_write failure). In such case the memory under

Re: [PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Krzysztof Kozlowski
On Thu, 2014-03-13 at 14:13 +, Mark Brown wrote: On Thu, Mar 13, 2014 at 09:06:01AM +0100, Krzysztof Kozlowski wrote: After setting the 'data' pointer (wchich is returned to the caller for freeing later) the regmap_add_irq_chip() could still fail for various reasons (ENOMEM, regmap_read

Re: [PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Mark Brown
On Thu, Mar 13, 2014 at 03:33:04PM +0100, Krzysztof Kozlowski wrote: Yes, you're right but still I think that 'data' should be set in a atomic way - only if regmap_add_irq_chip() succeeds. Usually a caller passing a pointer for allocation expects that one of: 1. Allocation succeeds and it is

Re: [PATCH] regmap: irq: Set data pointer only on regmap_add_irq_chip success

2014-03-13 Thread Mark Brown
On Thu, Mar 13, 2014 at 09:06:01AM +0100, Krzysztof Kozlowski wrote: After setting the 'data' pointer (wchich is returned to the caller for freeing later) the regmap_add_irq_chip() could still fail for various reasons (ENOMEM, regmap_read or regmap_write failure). In such case the memory under