All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Balaji T K <balajitk@ti.com>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm: omap4: hsmmc: check for null pointer
Date: Mon, 9 Apr 2012 17:08:09 -0700	[thread overview]
Message-ID: <20120410000808.GE6487@atomide.com> (raw)
In-Reply-To: <1333460858-9324-1-git-send-email-balajitk@ti.com>

* Balaji T K <balajitk@ti.com> [120403 06:47]:
> platform_device pdev can be NULL if CONFIG_MMC_OMAP_HS is not set.
> Add check for NULL pointer
> 
> Fixes the following boot crash seen with omap4sdp and omap4panda
> when MMC is disabled.
> 
> Unable to handle kernel NULL pointer dereference at virtual address 0000008c
> pgd = c0004000
> [0000008c] *pgd=00000000
> Internal error: Oops: 5 [#1] SMP ARM
> Modules linked in:
> CPU: 0    Not tainted  (3.4.0-rc1-05971-ga4dfa82 #4)
> PC is at omap_4430sdp_init+0x184/0x410
> LR is at device_add+0x1a0/0x664
> 
> Signed-off-by: Balaji T K <balajitk@ti.com>
> Reported-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> ---
>  arch/arm/mach-omap2/board-4430sdp.c    |    6 +++++-
>  arch/arm/mach-omap2/board-omap4panda.c |    6 +++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index a39fc4b..1ce771d 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -526,8 +526,12 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
>  	struct omap2_hsmmc_info *c;
>  
>  	omap_hsmmc_init(controllers);
> -	for (c = controllers; c->mmc; c++)
> +	for (c = controllers; c->mmc; c++) {
> +		/* pdev can be null if CONFIG_MMC_OMAP_HS is not set */
> +		if (!c->pdev)
> +			continue;
>  		omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
> +	}
>  
>  	return 0;
>  }
> diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
> index d8c0e89..104fd6d 100644
> --- a/arch/arm/mach-omap2/board-omap4panda.c
> +++ b/arch/arm/mach-omap2/board-omap4panda.c
> @@ -278,8 +278,12 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
>  	struct omap2_hsmmc_info *c;
>  
>  	omap_hsmmc_init(controllers);
> -	for (c = controllers; c->mmc; c++)
> +	for (c = controllers; c->mmc; c++) {
> +		/* pdev can be null if CONFIG_MMC_OMAP_HS is not set */
> +		if (!c->pdev)
> +			continue;
>  		omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
> +	}
>  
>  	return 0;
>  }

Uhh cut and paste duplicate code.. Let's get rid of that while at
it. Can you please update this so we have only one copy of
omap4_twl6030_hsmmc_init in some place, maybe in one of the
arch/arm/mach-omap2/*twl*.c files?

Thanks,

Tony

WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: omap4: hsmmc: check for null pointer
Date: Mon, 9 Apr 2012 17:08:09 -0700	[thread overview]
Message-ID: <20120410000808.GE6487@atomide.com> (raw)
In-Reply-To: <1333460858-9324-1-git-send-email-balajitk@ti.com>

* Balaji T K <balajitk@ti.com> [120403 06:47]:
> platform_device pdev can be NULL if CONFIG_MMC_OMAP_HS is not set.
> Add check for NULL pointer
> 
> Fixes the following boot crash seen with omap4sdp and omap4panda
> when MMC is disabled.
> 
> Unable to handle kernel NULL pointer dereference at virtual address 0000008c
> pgd = c0004000
> [0000008c] *pgd=00000000
> Internal error: Oops: 5 [#1] SMP ARM
> Modules linked in:
> CPU: 0    Not tainted  (3.4.0-rc1-05971-ga4dfa82 #4)
> PC is at omap_4430sdp_init+0x184/0x410
> LR is at device_add+0x1a0/0x664
> 
> Signed-off-by: Balaji T K <balajitk@ti.com>
> Reported-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> ---
>  arch/arm/mach-omap2/board-4430sdp.c    |    6 +++++-
>  arch/arm/mach-omap2/board-omap4panda.c |    6 +++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index a39fc4b..1ce771d 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -526,8 +526,12 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
>  	struct omap2_hsmmc_info *c;
>  
>  	omap_hsmmc_init(controllers);
> -	for (c = controllers; c->mmc; c++)
> +	for (c = controllers; c->mmc; c++) {
> +		/* pdev can be null if CONFIG_MMC_OMAP_HS is not set */
> +		if (!c->pdev)
> +			continue;
>  		omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
> +	}
>  
>  	return 0;
>  }
> diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
> index d8c0e89..104fd6d 100644
> --- a/arch/arm/mach-omap2/board-omap4panda.c
> +++ b/arch/arm/mach-omap2/board-omap4panda.c
> @@ -278,8 +278,12 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
>  	struct omap2_hsmmc_info *c;
>  
>  	omap_hsmmc_init(controllers);
> -	for (c = controllers; c->mmc; c++)
> +	for (c = controllers; c->mmc; c++) {
> +		/* pdev can be null if CONFIG_MMC_OMAP_HS is not set */
> +		if (!c->pdev)
> +			continue;
>  		omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
> +	}
>  
>  	return 0;
>  }

Uhh cut and paste duplicate code.. Let's get rid of that while at
it. Can you please update this so we have only one copy of
omap4_twl6030_hsmmc_init in some place, maybe in one of the
arch/arm/mach-omap2/*twl*.c files?

Thanks,

Tony

  parent reply	other threads:[~2012-04-10  0:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 13:47 [PATCH] arm: omap4: hsmmc: check for null pointer Balaji T K
2012-04-03 13:47 ` Balaji T K
2012-04-03 13:53 ` Shilimkar, Santosh
2012-04-03 13:53   ` Shilimkar, Santosh
2012-04-10  0:08 ` Tony Lindgren [this message]
2012-04-10  0:08   ` Tony Lindgren

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=20120410000808.GE6487@atomide.com \
    --to=tony@atomide.com \
    --cc=balajitk@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.