* [PATCH] usb: ehci: initialize ehci_data @ 2013-03-04 16:00 Sascha Hauer 2013-03-04 19:05 ` Jean-Christophe PLAGNIOL-VILLARD 2013-03-08 5:57 ` Antony Pavlov 0 siblings, 2 replies; 8+ messages in thread From: Sascha Hauer @ 2013-03-04 16:00 UTC (permalink / raw) To: barebox Without it fields of ehci_data may be unitialized and the driver crashes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/usb/host/ehci-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 0c789e4..7c389aa 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -892,7 +892,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data) static int ehci_probe(struct device_d *dev) { - struct ehci_data data; + struct ehci_data data = {}; struct ehci_platform_data *pdata = dev->platform_data; /* default to EHCI_HAS_TT to not change behaviour of boards -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: ehci: initialize ehci_data 2013-03-04 16:00 [PATCH] usb: ehci: initialize ehci_data Sascha Hauer @ 2013-03-04 19:05 ` Jean-Christophe PLAGNIOL-VILLARD 2013-03-04 19:16 ` Sascha Hauer 2013-03-08 5:57 ` Antony Pavlov 1 sibling, 1 reply; 8+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-04 19:05 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox On 17:00 Mon 04 Mar , Sascha Hauer wrote: > Without it fields of ehci_data may be unitialized and the driver > crashes. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > drivers/usb/host/ehci-hcd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > index 0c789e4..7c389aa 100644 > --- a/drivers/usb/host/ehci-hcd.c > +++ b/drivers/usb/host/ehci-hcd.c > @@ -892,7 +892,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data) > > static int ehci_probe(struct device_d *dev) > { > - struct ehci_data data; > + struct ehci_data data = {}; I'll prefer a memset > struct ehci_platform_data *pdata = dev->platform_data; > > /* default to EHCI_HAS_TT to not change behaviour of boards > -- > 1.7.10.4 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: ehci: initialize ehci_data 2013-03-04 19:05 ` Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-04 19:16 ` Sascha Hauer 2013-03-04 19:25 ` Alexander Aring 0 siblings, 1 reply; 8+ messages in thread From: Sascha Hauer @ 2013-03-04 19:16 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox On Mon, Mar 04, 2013 at 08:05:29PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 17:00 Mon 04 Mar , Sascha Hauer wrote: > > Without it fields of ehci_data may be unitialized and the driver > > crashes. > > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > > --- > > drivers/usb/host/ehci-hcd.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > > index 0c789e4..7c389aa 100644 > > --- a/drivers/usb/host/ehci-hcd.c > > +++ b/drivers/usb/host/ehci-hcd.c > > @@ -892,7 +892,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data) > > > > static int ehci_probe(struct device_d *dev) > > { > > - struct ehci_data data; > > + struct ehci_data data = {}; > > I'll prefer a memset Then you'll happy to hear that this is what the compiler makes from it anyway. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: ehci: initialize ehci_data 2013-03-04 19:16 ` Sascha Hauer @ 2013-03-04 19:25 ` Alexander Aring 2013-03-04 19:28 ` Sascha Hauer 0 siblings, 1 reply; 8+ messages in thread From: Alexander Aring @ 2013-03-04 19:25 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox On Mon, Mar 04, 2013 at 08:16:17PM +0100, Sascha Hauer wrote: > On Mon, Mar 04, 2013 at 08:05:29PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > > On 17:00 Mon 04 Mar , Sascha Hauer wrote: > > > Without it fields of ehci_data may be unitialized and the driver > > > crashes. > > > > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > > > --- > > > drivers/usb/host/ehci-hcd.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > > > index 0c789e4..7c389aa 100644 > > > --- a/drivers/usb/host/ehci-hcd.c > > > +++ b/drivers/usb/host/ehci-hcd.c > > > @@ -892,7 +892,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data) > > > > > > static int ehci_probe(struct device_d *dev) > > > { > > > - struct ehci_data data; > > > + struct ehci_data data = {}; > > > > I'll prefer a memset > > Then you'll happy to hear that this is what the compiler makes from it > anyway. > I think memset use a unnecessary function call. Is that right? _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: ehci: initialize ehci_data 2013-03-04 19:25 ` Alexander Aring @ 2013-03-04 19:28 ` Sascha Hauer 2013-03-04 19:32 ` Alexander Aring 0 siblings, 1 reply; 8+ messages in thread From: Sascha Hauer @ 2013-03-04 19:28 UTC (permalink / raw) To: Alexander Aring; +Cc: barebox On Mon, Mar 04, 2013 at 08:25:49PM +0100, Alexander Aring wrote: > On Mon, Mar 04, 2013 at 08:16:17PM +0100, Sascha Hauer wrote: > > On Mon, Mar 04, 2013 at 08:05:29PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > > > On 17:00 Mon 04 Mar , Sascha Hauer wrote: > > > > Without it fields of ehci_data may be unitialized and the driver > > > > crashes. > > > > > > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > > > > --- > > > > drivers/usb/host/ehci-hcd.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > > > > index 0c789e4..7c389aa 100644 > > > > --- a/drivers/usb/host/ehci-hcd.c > > > > +++ b/drivers/usb/host/ehci-hcd.c > > > > @@ -892,7 +892,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data) > > > > > > > > static int ehci_probe(struct device_d *dev) > > > > { > > > > - struct ehci_data data; > > > > + struct ehci_data data = {}; > > > > > > I'll prefer a memset > > > > Then you'll happy to hear that this is what the compiler makes from it > > anyway. > > > I think memset use a unnecessary function call. Is that right? No, the result will be the same. As said, gcc will call memset anyway, even when you implicitly initialize a struct with '= {}'. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: ehci: initialize ehci_data 2013-03-04 19:28 ` Sascha Hauer @ 2013-03-04 19:32 ` Alexander Aring 0 siblings, 0 replies; 8+ messages in thread From: Alexander Aring @ 2013-03-04 19:32 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox On Mon, Mar 04, 2013 at 08:28:35PM +0100, Sascha Hauer wrote: > On Mon, Mar 04, 2013 at 08:25:49PM +0100, Alexander Aring wrote: > > On Mon, Mar 04, 2013 at 08:16:17PM +0100, Sascha Hauer wrote: > > > On Mon, Mar 04, 2013 at 08:05:29PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > > > > On 17:00 Mon 04 Mar , Sascha Hauer wrote: > > > > > Without it fields of ehci_data may be unitialized and the driver > > > > > crashes. > > > > > > > > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > > > > > --- > > > > > drivers/usb/host/ehci-hcd.c | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > > > > > index 0c789e4..7c389aa 100644 > > > > > --- a/drivers/usb/host/ehci-hcd.c > > > > > +++ b/drivers/usb/host/ehci-hcd.c > > > > > @@ -892,7 +892,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data) > > > > > > > > > > static int ehci_probe(struct device_d *dev) > > > > > { > > > > > - struct ehci_data data; > > > > > + struct ehci_data data = {}; > > > > > > > > I'll prefer a memset > > > > > > Then you'll happy to hear that this is what the compiler makes from it > > > anyway. > > > > > I think memset use a unnecessary function call. Is that right? > > No, the result will be the same. As said, gcc will call memset anyway, > even when you implicitly initialize a struct with '= {}'. > Ok, thanks for this information. Alex _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: ehci: initialize ehci_data 2013-03-04 16:00 [PATCH] usb: ehci: initialize ehci_data Sascha Hauer 2013-03-04 19:05 ` Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 5:57 ` Antony Pavlov 2013-03-08 7:24 ` Sascha Hauer 1 sibling, 1 reply; 8+ messages in thread From: Antony Pavlov @ 2013-03-08 5:57 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox On 4 March 2013 20:00, Sascha Hauer <s.hauer@pengutronix.de> wrote: > Without it fields of ehci_data may be unitialized and the driver > crashes. Sascha! Please apply a patch like this! Without it the 'usb' command on my Tegra board hangs. > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > drivers/usb/host/ehci-hcd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > index 0c789e4..7c389aa 100644 > --- a/drivers/usb/host/ehci-hcd.c > +++ b/drivers/usb/host/ehci-hcd.c > @@ -892,7 +892,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data) > > static int ehci_probe(struct device_d *dev) > { > - struct ehci_data data; > + struct ehci_data data = {}; > struct ehci_platform_data *pdata = dev->platform_data; > > /* default to EHCI_HAS_TT to not change behaviour of boards > -- > 1.7.10.4 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox -- Best regards, Antony Pavlov _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: ehci: initialize ehci_data 2013-03-08 5:57 ` Antony Pavlov @ 2013-03-08 7:24 ` Sascha Hauer 0 siblings, 0 replies; 8+ messages in thread From: Sascha Hauer @ 2013-03-08 7:24 UTC (permalink / raw) To: Antony Pavlov; +Cc: barebox Hi Antony, On Fri, Mar 08, 2013 at 09:57:10AM +0400, Antony Pavlov wrote: > On 4 March 2013 20:00, Sascha Hauer <s.hauer@pengutronix.de> wrote: > > Without it fields of ehci_data may be unitialized and the driver > > crashes. > > Sascha! > > Please apply a patch like this! Without it the 'usb' command on my > Tegra board hangs. Just did that. Sascha > > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > > --- > > drivers/usb/host/ehci-hcd.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > > index 0c789e4..7c389aa 100644 > > --- a/drivers/usb/host/ehci-hcd.c > > +++ b/drivers/usb/host/ehci-hcd.c > > @@ -892,7 +892,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data) > > > > static int ehci_probe(struct device_d *dev) > > { > > - struct ehci_data data; > > + struct ehci_data data = {}; > > struct ehci_platform_data *pdata = dev->platform_data; > > > > /* default to EHCI_HAS_TT to not change behaviour of boards > > -- > > 1.7.10.4 > > > > > > _______________________________________________ > > barebox mailing list > > barebox@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/barebox > > > > -- > Best regards, > Antony Pavlov > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-03-08 7:24 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-03-04 16:00 [PATCH] usb: ehci: initialize ehci_data Sascha Hauer 2013-03-04 19:05 ` Jean-Christophe PLAGNIOL-VILLARD 2013-03-04 19:16 ` Sascha Hauer 2013-03-04 19:25 ` Alexander Aring 2013-03-04 19:28 ` Sascha Hauer 2013-03-04 19:32 ` Alexander Aring 2013-03-08 5:57 ` Antony Pavlov 2013-03-08 7:24 ` Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox