Hi Claudio, > <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! > As per your comments, I am posting 4 patches separately. ÿô.nÇ·®+%˱é¥wÿº{.nÇ·¥{±ý¶â^nr¡öë¨è&£ûz¹Þúzf£¢·h§~Ûÿÿïÿê_èæ+v¨þ)ßø