Re: [PATCH 03/16] Bluetooth: hidp: simplify error path in sock-init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gustavo

On Tue, Feb 26, 2013 at 8:56 PM, Gustavo Padovan <gustavo@xxxxxxxxxxx> wrote:
> Hi David,
>
> * David Herrmann <dh.herrmann@xxxxxxxxx> [2013-02-24 19:36:53 +0100]:
>
>> We currently print errors twice when doing a "goto error;". Avoid this and
>> also use labels for each error-condition. We shouldn't mix
>> "inline-cleanup" and "goto-cleanup" in a single function. It makes
>> extending the function later just more work.
>>
>> Signed-off-by: David Herrmann <dh.herrmann@xxxxxxxxx>
>> ---
>>  net/bluetooth/hidp/sock.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
>> index 5d0f1ca..ca86436 100644
>> --- a/net/bluetooth/hidp/sock.c
>> +++ b/net/bluetooth/hidp/sock.c
>> @@ -281,22 +281,22 @@ int __init hidp_init_sockets(void)
>>       err = bt_sock_register(BTPROTO_HIDP, &hidp_sock_family_ops);
>>       if (err < 0) {
>>               BT_ERR("Can't register HIDP socket");
>> -             goto error;
>> +             goto err_proto;
>>       }
>>
>>       err = bt_procfs_init(THIS_MODULE, &init_net, "hidp", &hidp_sk_list, NULL);
>>       if (err < 0) {
>>               BT_ERR("Failed to create HIDP proc file");
>> -             bt_sock_unregister(BTPROTO_HIDP);
>> -             goto error;
>> +             goto err_sock;
>
> Actually I'm ok with mixing inline and goto clean up here, It's simpler
> than add another goto.

But it makes review harder. If there's one central place (trailing
goto's) where cleanup is done, it's much easier to review
cleanup-paths. Anyway, your decision. I will fix it up and resend.

Thanks!
David
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux