* [PATCH] [media] cx23885-dvb: move initialization of a8293_pdata
@ 2015-12-18 16:26 Mauro Carvalho Chehab
2015-12-18 16:52 ` David Howells
0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2015-12-18 16:26 UTC (permalink / raw)
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, Antti Palosaari, Hans Verkuil,
Junghak Sung, Inki Dae, Olli Salonen, David Howells
Smatch complains about where the au8293_data is placed:
drivers/media/pci/cx23885/cx23885-dvb.c:2174 dvb_register() info: 'a8293_pdata' is not actually initialized (unreached code).
It is not actually expected to have such initialization at
switch {
foo = bar;
case:
...
}
Not really sure how gcc does that, but this is something that I would
expect that different compilers would do different things.
So, move the initialization outside the switch(), making smatch to
shut up one warning.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
drivers/media/pci/cx23885/cx23885-dvb.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c
index adabb0bc21ad..80319bb73d94 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -2168,10 +2168,11 @@ static int dvb_register(struct cx23885_tsport *port)
}
port->i2c_client_tuner = client_tuner;
break;
- case CX23885_BOARD_HAUPPAUGE_HVR5525:
- switch (port->nr) {
+ case CX23885_BOARD_HAUPPAUGE_HVR5525: {
struct m88rs6000t_config m88rs6000t_config;
- struct a8293_platform_data a8293_pdata = { 0 };
+ struct a8293_platform_data a8293_pdata = {};
+
+ switch (port->nr) {
/* port b - satellite */
case 1:
@@ -2267,6 +2268,7 @@ static int dvb_register(struct cx23885_tsport *port)
break;
}
break;
+ }
default:
printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
" isn't supported yet\n",
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [media] cx23885-dvb: move initialization of a8293_pdata
2015-12-18 16:26 [PATCH] [media] cx23885-dvb: move initialization of a8293_pdata Mauro Carvalho Chehab
@ 2015-12-18 16:52 ` David Howells
2015-12-18 17:23 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2015-12-18 16:52 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: dhowells, Linux Media Mailing List, Mauro Carvalho Chehab,
Antti Palosaari, Hans Verkuil, Junghak Sung, Inki Dae,
Olli Salonen
Mauro Carvalho Chehab <mchehab@osg.samsung.com> wrote:
> Smatch complains about where the au8293_data is placed:
>
> drivers/media/pci/cx23885/cx23885-dvb.c:2174 dvb_register() info: 'a8293_pdata' is not actually initialized (unreached code).
>
> It is not actually expected to have such initialization at
>
> switch {
> foo = bar;
>
> case:
> ...
> }
>
> Not really sure how gcc does that, but this is something that I would
> expect that different compilers would do different things.
>
> So, move the initialization outside the switch(), making smatch to
> shut up one warning.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Yeah - checked with the compiler people: it's not really expected to
initialise as expected.
Acked-by: David Howells <dhowells@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [media] cx23885-dvb: move initialization of a8293_pdata
2015-12-18 16:52 ` David Howells
@ 2015-12-18 17:23 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2015-12-18 17:23 UTC (permalink / raw)
To: David Howells
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Antti Palosaari,
Hans Verkuil, Junghak Sung, Inki Dae, Olli Salonen
Em Fri, 18 Dec 2015 16:52:40 +0000
David Howells <dhowells@redhat.com> escreveu:
> Mauro Carvalho Chehab <mchehab@osg.samsung.com> wrote:
>
> > Smatch complains about where the au8293_data is placed:
> >
> > drivers/media/pci/cx23885/cx23885-dvb.c:2174 dvb_register() info: 'a8293_pdata' is not actually initialized (unreached code).
> >
> > It is not actually expected to have such initialization at
> >
> > switch {
> > foo = bar;
> >
> > case:
> > ...
> > }
> >
> > Not really sure how gcc does that, but this is something that I would
> > expect that different compilers would do different things.
> >
> > So, move the initialization outside the switch(), making smatch to
> > shut up one warning.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> Yeah - checked with the compiler people: it's not really expected to
> initialise as expected.
Thank you for checking it! Yeah, the above code weren't smelling
well ;) Good to know for sure that such constructions may not be
doing what humans would expect...
> Acked-by: David Howells <dhowells@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-18 17:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18 16:26 [PATCH] [media] cx23885-dvb: move initialization of a8293_pdata Mauro Carvalho Chehab
2015-12-18 16:52 ` David Howells
2015-12-18 17:23 ` Mauro Carvalho Chehab
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).