mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi: check platform_device_register_simple() error
@ 2006-11-27  5:09 Akinobu Mita
  2006-11-27 18:28 ` David Brownell
  2006-11-28  0:08 ` Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: Akinobu Mita @ 2006-11-27  5:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: David Brownell

This patch checks the return value of platform_device_register_simple().

Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

---
 drivers/spi/spi_butterfly.c |    2 ++
 1 file changed, 2 insertions(+)

Index: work-fault-inject/drivers/spi/spi_butterfly.c
===================================================================
--- work-fault-inject.orig/drivers/spi/spi_butterfly.c
+++ work-fault-inject/drivers/spi/spi_butterfly.c
@@ -250,6 +250,8 @@ static void butterfly_attach(struct parp
 	 * setting up a platform device like this is an ugly kluge...
 	 */
 	pdev = platform_device_register_simple("butterfly", -1, NULL, 0);
+	if (IS_ERR(pdev))
+		return;
 
 	master = spi_alloc_master(&pdev->dev, sizeof *pp);
 	if (!master) {

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

* Re: [PATCH] spi: check platform_device_register_simple() error
  2006-11-27  5:09 [PATCH] spi: check platform_device_register_simple() error Akinobu Mita
@ 2006-11-27 18:28 ` David Brownell
  2006-11-28  0:08 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: David Brownell @ 2006-11-27 18:28 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-kernel

On Sunday 26 November 2006 9:09 pm, Akinobu Mita wrote:
> This patch checks the return value of platform_device_register_simple().
> 
> Cc: David Brownell <dbrownell@users.sourceforge.net>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

Acked-by: David Brownell <dbrownell@users.sourceforge.net>

... thanks, good catch.


> 
> ---
>  drivers/spi/spi_butterfly.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: work-fault-inject/drivers/spi/spi_butterfly.c
> ===================================================================
> --- work-fault-inject.orig/drivers/spi/spi_butterfly.c
> +++ work-fault-inject/drivers/spi/spi_butterfly.c
> @@ -250,6 +250,8 @@ static void butterfly_attach(struct parp
>  	 * setting up a platform device like this is an ugly kluge...
>  	 */
>  	pdev = platform_device_register_simple("butterfly", -1, NULL, 0);
> +	if (IS_ERR(pdev))
> +		return;
>  
>  	master = spi_alloc_master(&pdev->dev, sizeof *pp);
>  	if (!master) {
> 

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

* Re: [PATCH] spi: check platform_device_register_simple() error
  2006-11-27  5:09 [PATCH] spi: check platform_device_register_simple() error Akinobu Mita
  2006-11-27 18:28 ` David Brownell
@ 2006-11-28  0:08 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2006-11-28  0:08 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-kernel, David Brownell

On Mon, 27 Nov 2006 14:09:15 +0900
Akinobu Mita <akinobu.mita@gmail.com> wrote:

> This patch checks the return value of platform_device_register_simple().
> 
> Cc: David Brownell <dbrownell@users.sourceforge.net>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> 
> ---
>  drivers/spi/spi_butterfly.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: work-fault-inject/drivers/spi/spi_butterfly.c
> ===================================================================
> --- work-fault-inject.orig/drivers/spi/spi_butterfly.c
> +++ work-fault-inject/drivers/spi/spi_butterfly.c
> @@ -250,6 +250,8 @@ static void butterfly_attach(struct parp
>  	 * setting up a platform device like this is an ugly kluge...
>  	 */
>  	pdev = platform_device_register_simple("butterfly", -1, NULL, 0);
> +	if (IS_ERR(pdev))
> +		return;

It'd be nice to at least print some (non-debug) message rather than simply
mysteriously failing.

It'd be nicer if parport_driver.attach() didn't return void.  Ho hum.

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

end of thread, other threads:[~2006-11-28  0:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-27  5:09 [PATCH] spi: check platform_device_register_simple() error Akinobu Mita
2006-11-27 18:28 ` David Brownell
2006-11-28  0:08 ` Andrew Morton

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

all inboxes | Powered by JetHome®