2010-07-27 11:28:04

by Counihan, Tom

[permalink] [raw]
Subject: [PATCH] De-register pbap drivers on init failure scenarios

Unwind the driver registration/phonebook initialization stack on pbap plugin init failure scenarios.


---
plugins/pbap.c | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/plugins/pbap.c b/plugins/pbap.c
index af4b452..2d3bebd 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -892,21 +892,36 @@ static int pbap_init(void)

err = phonebook_init();
if (err < 0)
- return err;
+ goto fail_pb_init;

err = obex_mime_type_driver_register(&mime_pull);
if (err < 0)
- return err;
+ goto fail_mime_pull;

err = obex_mime_type_driver_register(&mime_list);
if (err < 0)
- return err;
+ goto fail_mime_list;

err = obex_mime_type_driver_register(&mime_vcard);
if (err < 0)
- return err;
+ goto fail_mime_vcard;
+
+ err = obex_service_driver_register(&pbap);
+ if (err < 0)
+ goto fail_pbap_reg;

- return obex_service_driver_register(&pbap);
+ return 0;
+
+fail_pbap_reg:
+ obex_mime_type_driver_unregister(&mime_vcard);
+fail_mime_vcard:
+ obex_mime_type_driver_unregister(&mime_list);
+fail_mime_list:
+ obex_mime_type_driver_unregister(&mime_pull);
+fail_mime_pull:
+ phonebook_exit();
+fail_pb_init:
+ return err;
}

static void pbap_exit(void)
--
1.7.1.1



--------------------------------------------------------------
Intel Shannon Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263
Business address: Dromore House, East Park, Shannon, Co. Clare

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.




2010-07-27 15:41:27

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] De-register pbap drivers on init failure scenarios

Hi Johan,

> > Unwind the driver registration/phonebook initialization stack on pbap plugin init failure scenarios.
> >
> >
> > ---
> > plugins/pbap.c | 25 ++++++++++++++++++++-----
> > 1 files changed, 20 insertions(+), 5 deletions(-)
>
> Thanks for the patch! It's now upstream. In the future please pay
> attention to your commit message line length. It shouldn't exceed 74
> characters (or so) in order to be nicely viewable on a 80-character wide
> terminal using git log. I fixed it this time for you manually.

please pay attention to Outlook/Exchange users where the the firstname,
lastname thing is reversed :(

Tom, Ensure that patches have a proper From: line first with the correct
name in the correct order.

Regards

Marcel



2010-07-27 12:31:29

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] De-register pbap drivers on init failure scenarios

Hi Tom,

On Tue, Jul 27, 2010, Counihan, Tom wrote:
> Unwind the driver registration/phonebook initialization stack on pbap plugin init failure scenarios.
>
>
> ---
> plugins/pbap.c | 25 ++++++++++++++++++++-----
> 1 files changed, 20 insertions(+), 5 deletions(-)

Thanks for the patch! It's now upstream. In the future please pay
attention to your commit message line length. It shouldn't exceed 74
characters (or so) in order to be nicely viewable on a 80-character wide
terminal using git log. I fixed it this time for you manually.

Johan