* [PATCH] mgmt-tester: Fix clang warning
@ 2015-01-20 12:41 Andrei Emeltchenko
2015-01-20 16:12 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Andrei Emeltchenko @ 2015-01-20 12:41 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Fixes clang warning below:
...
tools/mgmt-tester.c:3805:2: warning: Value stored to 'id' is never read
id = mgmt_register(data->mgmt, MGMT_EV_DISCOVERING,
data->mgmt_index,
^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
...
---
tools/mgmt-tester.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 92351e4..295fef5 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -3802,7 +3802,7 @@ static void setup_start_discovery(const void *test_data)
uint16_t send_len = test->setup_send_len;
unsigned int id = 0;
- id = mgmt_register(data->mgmt, MGMT_EV_DISCOVERING, data->mgmt_index,
+ mgmt_register(data->mgmt, MGMT_EV_DISCOVERING, data->mgmt_index,
discovering_event, UINT_TO_PTR(id), NULL);
mgmt_send(data->mgmt, test->setup_send_opcode, data->mgmt_index,
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] mgmt-tester: Fix clang warning
2015-01-20 12:41 [PATCH] mgmt-tester: Fix clang warning Andrei Emeltchenko
@ 2015-01-20 16:12 ` Marcel Holtmann
2015-01-21 8:05 ` Andrei Emeltchenko
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2015-01-20 16:12 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
Hi Andrei,
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Fixes clang warning below:
> ...
> tools/mgmt-tester.c:3805:2: warning: Value stored to 'id' is never read
> id = mgmt_register(data->mgmt, MGMT_EV_DISCOVERING,
> data->mgmt_index,
> ^
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning generated.
> ...
> ---
> tools/mgmt-tester.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
> index 92351e4..295fef5 100644
> --- a/tools/mgmt-tester.c
> +++ b/tools/mgmt-tester.c
> @@ -3802,7 +3802,7 @@ static void setup_start_discovery(const void *test_data)
> uint16_t send_len = test->setup_send_len;
> unsigned int id = 0;
>
> - id = mgmt_register(data->mgmt, MGMT_EV_DISCOVERING, data->mgmt_index,
> + mgmt_register(data->mgmt, MGMT_EV_DISCOVERING, data->mgmt_index,
> discovering_event, UINT_TO_PTR(id), NULL);
this this is actually totally broken code. And not in the sense that clang reports it. You are not fixing the problem here. It is just masking the symptom.
Look into discovering_event callback and see what we do with the UINT_TO_PTR(0) that we are handing in. That code never did what the author was thinking it might do ;)
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mgmt-tester: Fix clang warning
2015-01-20 16:12 ` Marcel Holtmann
@ 2015-01-21 8:05 ` Andrei Emeltchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2015-01-21 8:05 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Tue, Jan 20, 2015 at 08:12:19AM -0800, Marcel Holtmann wrote:
> Hi Andrei,
>
> > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> >
> > Fixes clang warning below:
> > ...
> > tools/mgmt-tester.c:3805:2: warning: Value stored to 'id' is never read
> > id = mgmt_register(data->mgmt, MGMT_EV_DISCOVERING,
> > data->mgmt_index,
> > ^
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 1 warning generated.
> > ...
> > ---
> > tools/mgmt-tester.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
> > index 92351e4..295fef5 100644
> > --- a/tools/mgmt-tester.c
> > +++ b/tools/mgmt-tester.c
> > @@ -3802,7 +3802,7 @@ static void setup_start_discovery(const void *test_data)
> > uint16_t send_len = test->setup_send_len;
> > unsigned int id = 0;
> >
> > - id = mgmt_register(data->mgmt, MGMT_EV_DISCOVERING, data->mgmt_index,
> > + mgmt_register(data->mgmt, MGMT_EV_DISCOVERING, data->mgmt_index,
> > discovering_event, UINT_TO_PTR(id), NULL);
>
> this this is actually totally broken code. And not in the sense that clang reports it. You are not fixing the problem here. It is just masking the symptom.
>
> Look into discovering_event callback and see what we do with the UINT_TO_PTR(0) that we are handing in. That code never did what the author was thinking it might do ;)
>
Do you mean we shall use mgmt_unregister_index() instead of
mgmt_unregister() ?
Best regards
Andrei Emeltchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-21 8:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 12:41 [PATCH] mgmt-tester: Fix clang warning Andrei Emeltchenko
2015-01-20 16:12 ` Marcel Holtmann
2015-01-21 8:05 ` Andrei Emeltchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox