* [PATCH 1/4] tools/csr_usb : Fix Resource leak: file
@ 2014-10-15 14:08 Gowtham Anandha Babu
2014-10-15 14:08 ` [PATCH 2/4] tools/hciattach : Fix syntax error Gowtham Anandha Babu
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Gowtham Anandha Babu @ 2014-10-15 14:08 UTC (permalink / raw)
To: linux-bluetooth
Cc: luiz.dentz, d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu
Handles resource leak.
---
tools/csr_usb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/csr_usb.c b/tools/csr_usb.c
index 5fb6bdc..a1d7324 100644
--- a/tools/csr_usb.c
+++ b/tools/csr_usb.c
@@ -80,9 +80,12 @@ static int read_value(const char *name, const char *attr, const char *format)
return -1;
n = fscanf(file, format, &value);
- if (n != 1)
+ if (n != 1) {
+ fclose(file);
return -1;
+ }
+ fclose(file);
return value;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] tools/hciattach : Fix syntax error 2014-10-15 14:08 [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Gowtham Anandha Babu @ 2014-10-15 14:08 ` Gowtham Anandha Babu 2014-10-15 14:08 ` [PATCH 3/4] obexd/src/main: Fix coding style and improves readability Gowtham Anandha Babu ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Gowtham Anandha Babu @ 2014-10-15 14:08 UTC (permalink / raw) To: linux-bluetooth Cc: luiz.dentz, d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu This error may not be shown during normal compilation, because of ifdef. --- tools/hciattach.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/hciattach.c b/tools/hciattach.c index d8ef7e7..2ace6f5 100644 --- a/tools/hciattach.c +++ b/tools/hciattach.c @@ -128,7 +128,7 @@ int uart_speed(int s) return B3500000; #endif #ifdef B3710000 - case 3710000 + case 3710000: return B3710000; #endif #ifdef B4000000 -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] obexd/src/main: Fix coding style and improves readability 2014-10-15 14:08 [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Gowtham Anandha Babu 2014-10-15 14:08 ` [PATCH 2/4] tools/hciattach : Fix syntax error Gowtham Anandha Babu @ 2014-10-15 14:08 ` Gowtham Anandha Babu 2014-10-15 14:08 ` [PATCH 4/4] Fix enum coding-style Gowtham Anandha Babu 2014-10-16 8:17 ` [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Luiz Augusto von Dentz 3 siblings, 0 replies; 7+ messages in thread From: Gowtham Anandha Babu @ 2014-10-15 14:08 UTC (permalink / raw) To: linux-bluetooth Cc: luiz.dentz, d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu --- obexd/src/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/obexd/src/main.c b/obexd/src/main.c index 80645f8..0040c1e 100644 --- a/obexd/src/main.c +++ b/obexd/src/main.c @@ -199,7 +199,8 @@ const char *obex_option_capability(void) return option_capability; } -static gboolean is_dir(const char *dir) { +static gboolean is_dir(const char *dir) +{ struct stat st; if (stat(dir, &st) < 0) { @@ -290,8 +291,9 @@ int main(int argc, char *argv[]) } if (option_root[0] != '/') { - char *old_root = option_root, *home = getenv("HOME"); + const char *home = getenv("HOME"); if (home) { + char *old_root = option_root; option_root = g_strdup_printf("%s/%s", home, old_root); g_free(old_root); } -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] Fix enum coding-style 2014-10-15 14:08 [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Gowtham Anandha Babu 2014-10-15 14:08 ` [PATCH 2/4] tools/hciattach : Fix syntax error Gowtham Anandha Babu 2014-10-15 14:08 ` [PATCH 3/4] obexd/src/main: Fix coding style and improves readability Gowtham Anandha Babu @ 2014-10-15 14:08 ` Gowtham Anandha Babu 2014-10-16 7:59 ` Luiz Augusto von Dentz 2014-10-16 8:17 ` [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Luiz Augusto von Dentz 3 siblings, 1 reply; 7+ messages in thread From: Gowtham Anandha Babu @ 2014-10-15 14:08 UTC (permalink / raw) To: linux-bluetooth Cc: luiz.dentz, d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu Fix the enum coding-style as per the new coding style doc. --- lib/uuid.h | 8 ++++---- profiles/cups/cups.h | 16 ++++++++-------- profiles/health/hdp_types.h | 4 ++-- profiles/proximity/reporter.h | 6 +++--- profiles/time/server.c | 20 ++++++++++---------- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/uuid.h b/lib/uuid.h index 8303772..f05888a 100644 --- a/lib/uuid.h +++ b/lib/uuid.h @@ -142,10 +142,10 @@ extern "C" { typedef struct { enum { - BT_UUID_UNSPEC = 0, - BT_UUID16 = 16, - BT_UUID32 = 32, - BT_UUID128 = 128, + BT_UUID_UNSPEC = 0, + BT_UUID16 = 16, + BT_UUID32 = 32, + BT_UUID128 = 128, } type; union { uint16_t u16; diff --git a/profiles/cups/cups.h b/profiles/cups/cups.h index f4e0c01..dbea1bf 100644 --- a/profiles/cups/cups.h +++ b/profiles/cups/cups.h @@ -21,14 +21,14 @@ * */ -enum { /**** Backend exit codes ****/ - CUPS_BACKEND_OK = 0, /* Job completed successfully */ - CUPS_BACKEND_FAILED = 1, /* Job failed, use error-policy */ - CUPS_BACKEND_AUTH_REQUIRED = 2, /* Job failed, authentication required */ - CUPS_BACKEND_HOLD = 3, /* Job failed, hold job */ - CUPS_BACKEND_STOP = 4, /* Job failed, stop queue */ - CUPS_BACKEND_CANCEL = 5, /* Job failed, cancel job */ - CUPS_BACKEND_RETRY = 6, /* Failure requires us to retry (BlueZ specific) */ +enum { /**** Backend exit codes ****/ + CUPS_BACKEND_OK = 0, /* Job completed successfully */ + CUPS_BACKEND_FAILED = 1, /* Job failed, use error-policy */ + CUPS_BACKEND_AUTH_REQUIRED = 2, /* Job failed, authentication required */ + CUPS_BACKEND_HOLD = 3, /* Job failed, hold job */ + CUPS_BACKEND_STOP = 4, /* Job failed, stop queue */ + CUPS_BACKEND_CANCEL = 5, /* Job failed, cancel job */ + CUPS_BACKEND_RETRY = 6, /* Failure requires us to retry (BlueZ specific) */ }; int sdp_search_spp(sdp_session_t *sdp, uint8_t *channel); diff --git a/profiles/health/hdp_types.h b/profiles/health/hdp_types.h index b34b5e0..92f461a 100644 --- a/profiles/health/hdp_types.h +++ b/profiles/health/hdp_types.h @@ -49,8 +49,8 @@ #define HDP_SOURCE_ROLE_AS_STRING "source" typedef enum { - HDP_SOURCE = 0x00, - HDP_SINK = 0x01 + HDP_SOURCE = 0x00, + HDP_SINK = 0x01 } HdpRole; typedef enum { diff --git a/profiles/proximity/reporter.h b/profiles/proximity/reporter.h index a8e1aac..243db26 100644 --- a/profiles/proximity/reporter.h +++ b/profiles/proximity/reporter.h @@ -31,9 +31,9 @@ #define POWER_LEVEL_CHR_UUID 0x2A07 enum { - NO_ALERT = 0x00, - MILD_ALERT = 0x01, - HIGH_ALERT = 0x02, + NO_ALERT = 0x00, + MILD_ALERT = 0x01, + HIGH_ALERT = 0x02, }; void reporter_device_remove(struct btd_service *service); diff --git a/profiles/time/server.c b/profiles/time/server.c index 1716a5e..0b6f70b 100644 --- a/profiles/time/server.c +++ b/profiles/time/server.c @@ -55,22 +55,22 @@ #define CT_TIME_CHR_UUID 0x2A2B enum { - UPDATE_RESULT_SUCCESSFUL = 0, - UPDATE_RESULT_CANCELED = 1, - UPDATE_RESULT_NO_CONN = 2, - UPDATE_RESULT_ERROR = 3, - UPDATE_RESULT_TIMEOUT = 4, - UPDATE_RESULT_NOT_ATTEMPTED = 5, + UPDATE_RESULT_SUCCESSFUL = 0, + UPDATE_RESULT_CANCELED = 1, + UPDATE_RESULT_NO_CONN = 2, + UPDATE_RESULT_ERROR = 3, + UPDATE_RESULT_TIMEOUT = 4, + UPDATE_RESULT_NOT_ATTEMPTED = 5, }; enum { - UPDATE_STATE_IDLE = 0, - UPDATE_STATE_PENDING = 1, + UPDATE_STATE_IDLE = 0, + UPDATE_STATE_PENDING = 1, }; enum { - GET_REFERENCE_UPDATE = 1, - CANCEL_REFERENCE_UPDATE = 2, + GET_REFERENCE_UPDATE = 1, + CANCEL_REFERENCE_UPDATE = 2, }; static int encode_current_time(uint8_t value[10]) -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] Fix enum coding-style 2014-10-15 14:08 ` [PATCH 4/4] Fix enum coding-style Gowtham Anandha Babu @ 2014-10-16 7:59 ` Luiz Augusto von Dentz 0 siblings, 0 replies; 7+ messages in thread From: Luiz Augusto von Dentz @ 2014-10-16 7:59 UTC (permalink / raw) To: Gowtham Anandha Babu Cc: linux-bluetooth@vger.kernel.org, Dmitry Kasatkin, Bharat Panda, cpgs Hi, On Wed, Oct 15, 2014 at 5:08 PM, Gowtham Anandha Babu <gowtham.ab@samsung.com> wrote: > Fix the enum coding-style as per the new coding style doc. I guess the tabs confused you a little bit, the coding style is more about having the values in case they come from a specification, the alignment of the values don't need to be exactly as in the example in the coding style. > --- > lib/uuid.h | 8 ++++---- > profiles/cups/cups.h | 16 ++++++++-------- > profiles/health/hdp_types.h | 4 ++-- > profiles/proximity/reporter.h | 6 +++--- > profiles/time/server.c | 20 ++++++++++---------- > 5 files changed, 27 insertions(+), 27 deletions(-) > > diff --git a/lib/uuid.h b/lib/uuid.h > index 8303772..f05888a 100644 > --- a/lib/uuid.h > +++ b/lib/uuid.h > @@ -142,10 +142,10 @@ extern "C" { > > typedef struct { > enum { > - BT_UUID_UNSPEC = 0, > - BT_UUID16 = 16, > - BT_UUID32 = 32, > - BT_UUID128 = 128, > + BT_UUID_UNSPEC = 0, > + BT_UUID16 = 16, > + BT_UUID32 = 32, > + BT_UUID128 = 128, > } type; > union { > uint16_t u16; > diff --git a/profiles/cups/cups.h b/profiles/cups/cups.h > index f4e0c01..dbea1bf 100644 > --- a/profiles/cups/cups.h > +++ b/profiles/cups/cups.h > @@ -21,14 +21,14 @@ > * > */ > > -enum { /**** Backend exit codes ****/ > - CUPS_BACKEND_OK = 0, /* Job completed successfully */ > - CUPS_BACKEND_FAILED = 1, /* Job failed, use error-policy */ > - CUPS_BACKEND_AUTH_REQUIRED = 2, /* Job failed, authentication required */ > - CUPS_BACKEND_HOLD = 3, /* Job failed, hold job */ > - CUPS_BACKEND_STOP = 4, /* Job failed, stop queue */ > - CUPS_BACKEND_CANCEL = 5, /* Job failed, cancel job */ > - CUPS_BACKEND_RETRY = 6, /* Failure requires us to retry (BlueZ specific) */ > +enum { /**** Backend exit codes ****/ > + CUPS_BACKEND_OK = 0, /* Job completed successfully */ > + CUPS_BACKEND_FAILED = 1, /* Job failed, use error-policy */ > + CUPS_BACKEND_AUTH_REQUIRED = 2, /* Job failed, authentication required */ > + CUPS_BACKEND_HOLD = 3, /* Job failed, hold job */ > + CUPS_BACKEND_STOP = 4, /* Job failed, stop queue */ > + CUPS_BACKEND_CANCEL = 5, /* Job failed, cancel job */ > + CUPS_BACKEND_RETRY = 6, /* Failure requires us to retry (BlueZ specific) */ > }; > > int sdp_search_spp(sdp_session_t *sdp, uint8_t *channel); > diff --git a/profiles/health/hdp_types.h b/profiles/health/hdp_types.h > index b34b5e0..92f461a 100644 > --- a/profiles/health/hdp_types.h > +++ b/profiles/health/hdp_types.h > @@ -49,8 +49,8 @@ > #define HDP_SOURCE_ROLE_AS_STRING "source" > > typedef enum { > - HDP_SOURCE = 0x00, > - HDP_SINK = 0x01 > + HDP_SOURCE = 0x00, > + HDP_SINK = 0x01 > } HdpRole; > > typedef enum { > diff --git a/profiles/proximity/reporter.h b/profiles/proximity/reporter.h > index a8e1aac..243db26 100644 > --- a/profiles/proximity/reporter.h > +++ b/profiles/proximity/reporter.h > @@ -31,9 +31,9 @@ > #define POWER_LEVEL_CHR_UUID 0x2A07 > > enum { > - NO_ALERT = 0x00, > - MILD_ALERT = 0x01, > - HIGH_ALERT = 0x02, > + NO_ALERT = 0x00, > + MILD_ALERT = 0x01, > + HIGH_ALERT = 0x02, > }; > > void reporter_device_remove(struct btd_service *service); > diff --git a/profiles/time/server.c b/profiles/time/server.c > index 1716a5e..0b6f70b 100644 > --- a/profiles/time/server.c > +++ b/profiles/time/server.c > @@ -55,22 +55,22 @@ > #define CT_TIME_CHR_UUID 0x2A2B > > enum { > - UPDATE_RESULT_SUCCESSFUL = 0, > - UPDATE_RESULT_CANCELED = 1, > - UPDATE_RESULT_NO_CONN = 2, > - UPDATE_RESULT_ERROR = 3, > - UPDATE_RESULT_TIMEOUT = 4, > - UPDATE_RESULT_NOT_ATTEMPTED = 5, > + UPDATE_RESULT_SUCCESSFUL = 0, > + UPDATE_RESULT_CANCELED = 1, > + UPDATE_RESULT_NO_CONN = 2, > + UPDATE_RESULT_ERROR = 3, > + UPDATE_RESULT_TIMEOUT = 4, > + UPDATE_RESULT_NOT_ATTEMPTED = 5, > }; > > enum { > - UPDATE_STATE_IDLE = 0, > - UPDATE_STATE_PENDING = 1, > + UPDATE_STATE_IDLE = 0, > + UPDATE_STATE_PENDING = 1, > }; > > enum { > - GET_REFERENCE_UPDATE = 1, > - CANCEL_REFERENCE_UPDATE = 2, > + GET_REFERENCE_UPDATE = 1, > + CANCEL_REFERENCE_UPDATE = 2, > }; > > static int encode_current_time(uint8_t value[10]) > -- > 1.9.1 > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] tools/csr_usb : Fix Resource leak: file 2014-10-15 14:08 [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Gowtham Anandha Babu ` (2 preceding siblings ...) 2014-10-15 14:08 ` [PATCH 4/4] Fix enum coding-style Gowtham Anandha Babu @ 2014-10-16 8:17 ` Luiz Augusto von Dentz 2014-10-16 8:57 ` Gowtham Anandha Babu 3 siblings, 1 reply; 7+ messages in thread From: Luiz Augusto von Dentz @ 2014-10-16 8:17 UTC (permalink / raw) To: Gowtham Anandha Babu Cc: linux-bluetooth@vger.kernel.org, Dmitry Kasatkin, Bharat Panda, cpgs Hi, On Wed, Oct 15, 2014 at 5:08 PM, Gowtham Anandha Babu <gowtham.ab@samsung.com> wrote: > Handles resource leak. > --- > tools/csr_usb.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/tools/csr_usb.c b/tools/csr_usb.c > index 5fb6bdc..a1d7324 100644 > --- a/tools/csr_usb.c > +++ b/tools/csr_usb.c > @@ -80,9 +80,12 @@ static int read_value(const char *name, const char *attr, const char *format) > return -1; > > n = fscanf(file, format, &value); > - if (n != 1) > + if (n != 1) { > + fclose(file); > return -1; > + } > > + fclose(file); > return value; > } > > -- > 1.9.1 Applied 1-3, but note that I did some changes in the commit message, please be consistent and don't include things like space before ':' etc, it is always a good practice got look how previous commit have been formatted and follow the HACKING document. -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 1/4] tools/csr_usb : Fix Resource leak: file 2014-10-16 8:17 ` [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Luiz Augusto von Dentz @ 2014-10-16 8:57 ` Gowtham Anandha Babu 0 siblings, 0 replies; 7+ messages in thread From: Gowtham Anandha Babu @ 2014-10-16 8:57 UTC (permalink / raw) To: 'Luiz Augusto von Dentz' Cc: linux-bluetooth, 'Dmitry Kasatkin', 'Bharat Panda', cpgs Hi Luiz, > -----Original Message----- > From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com] > Sent: Thursday, October 16, 2014 1:48 PM > To: Gowtham Anandha Babu > Cc: linux-bluetooth@vger.kernel.org; Dmitry Kasatkin; Bharat Panda; > cpgs@samsung.com > Subject: Re: [PATCH 1/4] tools/csr_usb : Fix Resource leak: file > > Hi, > > On Wed, Oct 15, 2014 at 5:08 PM, Gowtham Anandha Babu > <gowtham.ab@samsung.com> wrote: > > Handles resource leak. > > --- > > tools/csr_usb.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/tools/csr_usb.c b/tools/csr_usb.c index 5fb6bdc..a1d7324 > > 100644 > > --- a/tools/csr_usb.c > > +++ b/tools/csr_usb.c > > @@ -80,9 +80,12 @@ static int read_value(const char *name, const char > *attr, const char *format) > > return -1; > > > > n = fscanf(file, format, &value); > > - if (n != 1) > > + if (n != 1) { > > + fclose(file); > > return -1; > > + } > > > > + fclose(file); > > return value; > > } > > > > -- > > 1.9.1 > > Applied 1-3, but note that I did some changes in the commit message, please > be consistent and don't include things like space before ':' > etc, it is always a good practice got look how previous commit have been > formatted and follow the HACKING document. > > > -- > Luiz Augusto von Dentz Sorry for the formatting errors and 50/72 format. I will follow the HACKING documents here after. Thanks ! Regards, Gowtham Anandha Babu ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-16 8:57 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-15 14:08 [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Gowtham Anandha Babu 2014-10-15 14:08 ` [PATCH 2/4] tools/hciattach : Fix syntax error Gowtham Anandha Babu 2014-10-15 14:08 ` [PATCH 3/4] obexd/src/main: Fix coding style and improves readability Gowtham Anandha Babu 2014-10-15 14:08 ` [PATCH 4/4] Fix enum coding-style Gowtham Anandha Babu 2014-10-16 7:59 ` Luiz Augusto von Dentz 2014-10-16 8:17 ` [PATCH 1/4] tools/csr_usb : Fix Resource leak: file Luiz Augusto von Dentz 2014-10-16 8:57 ` Gowtham Anandha Babu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).