lkml.org 
[lkml]   [2010]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mfd: check for NULL platform data
Hi Fabio,

On Thu, Nov 11, 2010 at 06:58:14AM -0800, Fabio Estevam wrote:
> Avoid kernel crash if platform data is NULL.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/mfd/mc13xxx-core.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
> index a2ac2ed..b4d6bb1 100644
> --- a/drivers/mfd/mc13xxx-core.c
> +++ b/drivers/mfd/mc13xxx-core.c
> @@ -757,6 +757,9 @@ err_revision:
>
> mc13xxx_unlock(mc13xxx);
>
> + if (pdata == NULL)
> + return 0;
> +
I'm not sure it's really needed to catch this error. Not passing pdata
isn't sensible and then maybe failing with a bang is better than
handling silently.

And if you want to break probing, do you really want to return 0, i.e.
let the binding succeed? IMHO (if you really want to handle pdata ==
NULL) you should fail before allocating the private data with
-ESOMETHINGSENSIBLE.

Thanks,
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-11-11 16:47    [W:0.087 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site