All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Cleanup dtl1_config
@ 2012-06-13 18:42 Devendra Naga
  2012-06-19  3:09 ` Gustavo Padovan
  0 siblings, 1 reply; 5+ messages in thread
From: Devendra Naga @ 2012-06-13 18:42 UTC (permalink / raw)
  To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg, linux-bluetooth
  Cc: Devendra Naga

the functions always return 0 on sucess and -ve error on failure.

This also removes variable i.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
 drivers/bluetooth/dtl1_cs.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 6e8d961..f532ce2 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -586,22 +586,19 @@ static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)
 static int dtl1_config(struct pcmcia_device *link)
 {
 	dtl1_info_t *info = link->priv;
-	int i;
 
 	/* Look for a generic full-sized window */
 	link->resource[0]->end = 8;
 	if (pcmcia_loop_config(link, dtl1_confcheck, NULL) < 0)
 		goto failed;
 
-	i = pcmcia_request_irq(link, dtl1_interrupt);
-	if (i != 0)
+	if (pcmcia_request_irq(link, dtl1_interrupt))
 		goto failed;
 
-	i = pcmcia_enable_device(link);
-	if (i != 0)
+	if (pcmcia_enable_device(link))
 		goto failed;
 
-	if (dtl1_open(info) != 0)
+	if (dtl1_open(info))
 		goto failed;
 
 	return 0;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Bluetooth: Cleanup dtl1_config
  2012-06-13 18:42 [PATCH] Bluetooth: Cleanup dtl1_config Devendra Naga
@ 2012-06-19  3:09 ` Gustavo Padovan
  2012-06-19  4:26   ` devendra.aaru
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo Padovan @ 2012-06-19  3:09 UTC (permalink / raw)
  To: Devendra Naga; +Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth

Hi Devendra,

* Devendra Naga <devendra.aaru@gmail.com> [2012-06-14 00:12:15 +0530]:

> the functions always return 0 on sucess and -ve error on failure.
> 
> This also removes variable i.
> 
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
> ---
>  drivers/bluetooth/dtl1_cs.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
> index 6e8d961..f532ce2 100644
> --- a/drivers/bluetooth/dtl1_cs.c
> +++ b/drivers/bluetooth/dtl1_cs.c
> @@ -586,22 +586,19 @@ static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)
>  static int dtl1_config(struct pcmcia_device *link)
>  {
>  	dtl1_info_t *info = link->priv;
> -	int i;
>  
>  	/* Look for a generic full-sized window */
>  	link->resource[0]->end = 8;
>  	if (pcmcia_loop_config(link, dtl1_confcheck, NULL) < 0)
>  		goto failed;
>  
> -	i = pcmcia_request_irq(link, dtl1_interrupt);
> -	if (i != 0)
> +	if (pcmcia_request_irq(link, dtl1_interrupt))
>  		goto failed;

I think this change is wrong, instead you might return i (that should be
renamed to 'err') when the failed label is accessed. This way you improve the
error report of this function.

	Gustavo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Bluetooth: Cleanup dtl1_config
  2012-06-19  3:09 ` Gustavo Padovan
@ 2012-06-19  4:26   ` devendra.aaru
  0 siblings, 0 replies; 5+ messages in thread
From: devendra.aaru @ 2012-06-19  4:26 UTC (permalink / raw)
  To: Gustavo Padovan, Devendra Naga, Marcel Holtmann, Johan Hedberg,
	linux-bluetooth

Hi Gustavo,

Thanks for reviewing the patch.

On Tue, Jun 19, 2012 at 8:39 AM, Gustavo Padovan <gustavo@padovan.org> wrot=
e:
> Hi Devendra,
>
> * Devendra Naga <devendra.aaru@gmail.com> [2012-06-14 00:12:15 +0530]:
>
>> the functions always return 0 on sucess and -ve error on failure.
>>
>> This also removes variable i.
>>
>> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
>> ---
>> =A0drivers/bluetooth/dtl1_cs.c | =A0 =A09 +++------
>> =A01 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
>> index 6e8d961..f532ce2 100644
>> --- a/drivers/bluetooth/dtl1_cs.c
>> +++ b/drivers/bluetooth/dtl1_cs.c
>> @@ -586,22 +586,19 @@ static int dtl1_confcheck(struct pcmcia_device *p_=
dev, void *priv_data)
>> =A0static int dtl1_config(struct pcmcia_device *link)
>> =A0{
>> =A0 =A0 =A0 dtl1_info_t *info =3D link->priv;
>> - =A0 =A0 int i;
>>
>> =A0 =A0 =A0 /* Look for a generic full-sized window */
>> =A0 =A0 =A0 link->resource[0]->end =3D 8;
>> =A0 =A0 =A0 if (pcmcia_loop_config(link, dtl1_confcheck, NULL) < 0)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto failed;
>>
>> - =A0 =A0 i =3D pcmcia_request_irq(link, dtl1_interrupt);
>> - =A0 =A0 if (i !=3D 0)
>> + =A0 =A0 if (pcmcia_request_irq(link, dtl1_interrupt))
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto failed;
>
> I think this change is wrong, instead you might return i (that should be
> renamed to 'err') when the failed label is accessed. This way you improve=
 the
> error report of this function.
>
You are correct.

You can expect a V2 of this with your comments mentioned.
> =A0 =A0 =A0 =A0Gustavo

Thanks,
Devendra.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Bluetooth: cleanup dtl1_config
  2012-06-19 16:21 [PATCH] Bluetooth: cleanup dtl1_config Devendra Naga
@ 2012-06-30 14:45 ` Gustavo Padovan
  0 siblings, 0 replies; 5+ messages in thread
From: Gustavo Padovan @ 2012-06-30 14:45 UTC (permalink / raw)
  To: Devendra Naga; +Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth

Hi Devendra,

* Devendra Naga <devendra.aaru@gmail.com> [2012-06-19 21:51:31 +0530]:

> 
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
> ---
>  drivers/bluetooth/dtl1_cs.c |   18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)

Patch has been applied to bluetooth-next, thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Bluetooth: cleanup dtl1_config
@ 2012-06-19 16:21 Devendra Naga
  2012-06-30 14:45 ` Gustavo Padovan
  0 siblings, 1 reply; 5+ messages in thread
From: Devendra Naga @ 2012-06-19 16:21 UTC (permalink / raw)
  To: Gustavo Padovan, Devendra Naga, Marcel Holtmann, Johan Hedberg,
	linux-bluetooth


Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
 drivers/bluetooth/dtl1_cs.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 6e8d961..aedcf4a 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -586,29 +586,31 @@ static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)
 static int dtl1_config(struct pcmcia_device *link)
 {
 	dtl1_info_t *info = link->priv;
-	int i;
+	int ret;
 
 	/* Look for a generic full-sized window */
 	link->resource[0]->end = 8;
-	if (pcmcia_loop_config(link, dtl1_confcheck, NULL) < 0)
+	ret = pcmcia_loop_config(link, dtl1_confcheck, NULL);
+	if (ret)
 		goto failed;
 
-	i = pcmcia_request_irq(link, dtl1_interrupt);
-	if (i != 0)
+	ret = pcmcia_request_irq(link, dtl1_interrupt);
+	if (ret)
 		goto failed;
 
-	i = pcmcia_enable_device(link);
-	if (i != 0)
+	ret = pcmcia_enable_device(link);
+	if (ret)
 		goto failed;
 
-	if (dtl1_open(info) != 0)
+	ret = dtl1_open(info);
+	if (ret)
 		goto failed;
 
 	return 0;
 
 failed:
 	dtl1_detach(link);
-	return -ENODEV;
+	return ret;
 }
 
 static const struct pcmcia_device_id dtl1_ids[] = {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-30 14:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13 18:42 [PATCH] Bluetooth: Cleanup dtl1_config Devendra Naga
2012-06-19  3:09 ` Gustavo Padovan
2012-06-19  4:26   ` devendra.aaru
2012-06-19 16:21 [PATCH] Bluetooth: cleanup dtl1_config Devendra Naga
2012-06-30 14:45 ` Gustavo Padovan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.