public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tlclk.c: pointers are handled by %p
@ 2005-12-15  9:18 Al Viro
  2005-12-15  9:57 ` Russell King
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2005-12-15  9:18 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


---

 drivers/char/tlclk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

f1bbf945c86b729c20199133daba358284fa3c32
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 12167c0..e8467dc 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -776,8 +776,8 @@ static int __init tlclk_init(void)
 	tlclk_device = platform_device_register_simple("telco_clock",
 				-1, NULL, 0);
 	if (!tlclk_device) {
-		printk(KERN_ERR " platform_device_register retruns 0x%X\n",
-			(unsigned int) tlclk_device);
+		printk(KERN_ERR " platform_device_register retruns 0x%p\n",
+			tlclk_device);
 		ret = -EBUSY;
 		goto out4;
 	}
-- 
0.99.9.GIT


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

* Re: [PATCH] tlclk.c: pointers are handled by %p
  2005-12-15  9:18 [PATCH] tlclk.c: pointers are handled by %p Al Viro
@ 2005-12-15  9:57 ` Russell King
  2005-12-16  6:55   ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King @ 2005-12-15  9:57 UTC (permalink / raw)
  To: Al Viro; +Cc: torvalds, linux-kernel

On Thu, Dec 15, 2005 at 09:18:35AM +0000, Al Viro wrote:
> diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
> index 12167c0..e8467dc 100644
> --- a/drivers/char/tlclk.c
> +++ b/drivers/char/tlclk.c
> @@ -776,8 +776,8 @@ static int __init tlclk_init(void)
>  	tlclk_device = platform_device_register_simple("telco_clock",
>  				-1, NULL, 0);
>  	if (!tlclk_device) {
> -		printk(KERN_ERR " platform_device_register retruns 0x%X\n",
> -			(unsigned int) tlclk_device);
> +		printk(KERN_ERR " platform_device_register retruns 0x%p\n",
> +			tlclk_device);

This looks really strange - we know what tlclk_device will be at that
printk - it'll be NULL because if it's anything different we wouldn't
be inside this if(){ }.

Moreover, this code is obviously bogus.  platform_device_register_simple
does not return NULL for the error case.  It should be something like:

	if (IS_ERR(tlclk_device)) {
		ret = PTR_ERR(tlclk_device);
		printk(KERN_ERR "platform_device_register returns %d\n",
		        ret);
		goto out4;
	}

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

* Re: [PATCH] tlclk.c: pointers are handled by %p
  2005-12-15  9:57 ` Russell King
@ 2005-12-16  6:55   ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2005-12-16  6:55 UTC (permalink / raw)
  To: Russell King; +Cc: Al Viro, torvalds, linux-kernel

On Thursday 15 December 2005 04:57, Russell King wrote:
> On Thu, Dec 15, 2005 at 09:18:35AM +0000, Al Viro wrote:
> > diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
> > index 12167c0..e8467dc 100644
> > --- a/drivers/char/tlclk.c
> > +++ b/drivers/char/tlclk.c
> > @@ -776,8 +776,8 @@ static int __init tlclk_init(void)
> >  	tlclk_device = platform_device_register_simple("telco_clock",
> >  				-1, NULL, 0);
> >  	if (!tlclk_device) {
> > -		printk(KERN_ERR " platform_device_register retruns 0x%X\n",
> > -			(unsigned int) tlclk_device);
> > +		printk(KERN_ERR " platform_device_register retruns 0x%p\n",
> > +			tlclk_device);
> 
> This looks really strange - we know what tlclk_device will be at that
> printk - it'll be NULL because if it's anything different we wouldn't
> be inside this if(){ }.
> 
> Moreover, this code is obviously bogus.  platform_device_register_simple
> does not return NULL for the error case.  It should be something like:
> 
> 	if (IS_ERR(tlclk_device)) {
> 		ret = PTR_ERR(tlclk_device);
> 		printk(KERN_ERR "platform_device_register returns %d\n",
> 		        ret);
> 		goto out4;
> 	}
> 

I have a patch killing usage of platform_register_device_simple in this
driver (converting to platform_device_alloc() + _add()). Will post in a
minute.

-- 
Dmitry

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

end of thread, other threads:[~2005-12-16  6:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-15  9:18 [PATCH] tlclk.c: pointers are handled by %p Al Viro
2005-12-15  9:57 ` Russell King
2005-12-16  6:55   ` Dmitry Torokhov

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