public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Al Viro <viro@ftp.linux.org.uk>,
	torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tlclk.c: pointers are handled by %p
Date: Fri, 16 Dec 2005 01:55:51 -0500	[thread overview]
Message-ID: <200512160155.52397.dtor_core@ameritech.net> (raw)
In-Reply-To: <20051215095754.GA32490@flint.arm.linux.org.uk>

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

      reply	other threads:[~2005-12-16  6:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=200512160155.52397.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=torvalds@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    /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