mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] smsc911x: Check platformdata pointer
@ 2012-09-10 11:33 Jan Weitzel
  2012-09-10 16:07 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Weitzel @ 2012-09-10 11:33 UTC (permalink / raw)
  To: barebox

If pdata is NULL smc911x_probe will crash. Checking the zero initialized
priv->shift results in default configuration if pdata is not set.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
 drivers/net/smc911x.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index bc1e001..f697608 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -435,7 +435,7 @@ static int smc911x_probe(struct device_d *dev)
 		priv->shift = pdata->shift;
 
 	if (is_32bit) {
-		if (pdata->shift) {
+		if (priv->shift) {
 			priv->reg_read = __smc911x_reg_readl_shift;
 			priv->reg_write = __smc911x_reg_writel_shift;
 		} else {
@@ -443,7 +443,7 @@ static int smc911x_probe(struct device_d *dev)
 			priv->reg_write = __smc911x_reg_writel;
 		}
 	} else {
-		if (pdata->shift) {
+		if (priv->shift) {
 			priv->reg_read = __smc911x_reg_readw_shift;
 			priv->reg_write = __smc911x_reg_writew_shift;
 		} else {
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] smsc911x: Check platformdata pointer
  2012-09-10 11:33 [PATCH] smsc911x: Check platformdata pointer Jan Weitzel
@ 2012-09-10 16:07 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2012-09-10 16:07 UTC (permalink / raw)
  To: Jan Weitzel; +Cc: barebox

On Mon, Sep 10, 2012 at 01:33:29PM +0200, Jan Weitzel wrote:
> If pdata is NULL smc911x_probe will crash. Checking the zero initialized
> priv->shift results in default configuration if pdata is not set.
> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>

Applied, thanks

Sascha

> ---
>  drivers/net/smc911x.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> index bc1e001..f697608 100644
> --- a/drivers/net/smc911x.c
> +++ b/drivers/net/smc911x.c
> @@ -435,7 +435,7 @@ static int smc911x_probe(struct device_d *dev)
>  		priv->shift = pdata->shift;
>  
>  	if (is_32bit) {
> -		if (pdata->shift) {
> +		if (priv->shift) {
>  			priv->reg_read = __smc911x_reg_readl_shift;
>  			priv->reg_write = __smc911x_reg_writel_shift;
>  		} else {
> @@ -443,7 +443,7 @@ static int smc911x_probe(struct device_d *dev)
>  			priv->reg_write = __smc911x_reg_writel;
>  		}
>  	} else {
> -		if (pdata->shift) {
> +		if (priv->shift) {
>  			priv->reg_read = __smc911x_reg_readw_shift;
>  			priv->reg_write = __smc911x_reg_writew_shift;
>  		} else {
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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] 2+ messages in thread

end of thread, other threads:[~2012-09-10 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-10 11:33 [PATCH] smsc911x: Check platformdata pointer Jan Weitzel
2012-09-10 16:07 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox