Re: [PATCH] HCI Commands for LE White List

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

 



Hi Sumit,

<snip>

> Is using a separate variable err for return type of a function problem here?
I didn't understand your question here.
hci_* functions return 0 on success or -1 on failure. On failure errno
can be read to get the error number.

> I could see same coding style of defining a variable to carry the error status in hcitool.c function cmd_lecc.
> Please confirm.
The coding style issue is the if else:
At this point "else" is not needed: there is a "exit(1)" inside the
"if" block. But if you need else the correct coding style is:
...
} else {
...

Instead of
...
}
else {
...

<snip>

>> > + Â Â Â err = hci_le_remove_from_white_list(dd, bdaddr ,bdaddr_type);
>> > + Â Â Â if (err < 0) {
>> > + Â Â Â Â Â Â Â perror("Cant remove from white list");
>> > + Â Â Â Â Â Â Â exit(1);
>> > + Â Â Â }
>> > + Â Â Â Âelse {
>> > + Â Â Â Â Â Â Â printf("Device removed from white list");
>> > + Â Â Â }
>> > +
>> > + Â Â Â hci_close_dev(dd);
>> Same coding style issue and close "dd"
>>
>
>
> Ok. Good point. But I could still find premature returns on error conditions via exits at several places in hcitool.c. Can I submit a separate patch for rectifying all such error conditions too?

sure!

Claudio
--
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