public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Fabio Estevam <fabioestevam@yahoo.com>
Cc: linux-kernel@vger.kernel.org, sameo@linux.intel.com,
	s.hauer@pengutronix.de
Subject: Re: [PATCH] mfd: check for NULL platform data
Date: Thu, 11 Nov 2010 16:44:07 +0100	[thread overview]
Message-ID: <20101111154407.GC18358@pengutronix.de> (raw)
In-Reply-To: <805862.49452.qm@web51006.mail.re2.yahoo.com>

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/  |

  reply	other threads:[~2010-11-11 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 14:58 [PATCH] mfd: check for NULL platform data Fabio Estevam
2010-11-11 15:44 ` Uwe Kleine-König [this message]
2010-11-26 10:23   ` Samuel Ortiz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101111154407.GC18358@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=fabioestevam@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox