All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] Fix warning in drivers/usb/media/ov511.c
Date: Thu, 16 Feb 2006 00:38:31 +0000	[thread overview]
Message-ID: <20060216003831.GA30735@kroah.com> (raw)
In-Reply-To: <1139970072.25492.4.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1440 bytes --]

On Wed, Feb 15, 2006 at 03:31:27PM -0800, Randy.Dunlap wrote:
> On Thu, 16 Feb 2006, H?kon L?vdal wrote:
> 
> > On 2/15/06, Greg KH <greg@kroah.com> wrote:
> > > On Tue, Feb 14, 2006 at 08:21:12PM -0600, Matthew Martin wrote:
> > > > -     unsigned char exp;
> > > > +     unsigned char exp = '\0';
> > >
> > > What's wrong with just "0" here?
> >
> > In my opinion '\0' is the correct representation here.
> >
> > '\0'	ASCII nul character
> > 0	arithmetic value zero
> > NULL	null pointer
> >
> > All of those _could_ be represented with just "0", however using 0 as
> > such a multipurpose character/value/pointer constant is not a good idea
> > because it makes the code less clear to read.
> >
> > Linus has been very clear on that NULL and only NULL should be used for
> > pointers, and there was a large set of patches converting from 0 to NULL
> > in 2004.
> >
> > How is '\0' vs 0 different?
> 
> I didn't see any problem with using '\0' either, as long as it's
> meant to be a character instead of an 8-bit integer.
> 
> Looking at ov511.c, it appears to be an 8-bit integer...
> so 0 makes more sense to me in this case.
> 
> I find its usage more interesting.  Did the patch also address
> this part?  What does this do?
> 
> 	sensor_get_exposure(ov, &exp);
> 	return sprintf(buf, "%d\n", exp >> 8);
> 
> Does that always print 0?  (for exp >> 8)

Heh, it should :)

Anyone have this device to test this with?

thanks,

greg k-h

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2006-02-16  0:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-15  2:21 [KJ] [PATCH] Fix warning in drivers/usb/media/ov511.c Matthew Martin
2006-02-15  3:04 ` Greg KH
2006-02-15 16:30 ` Nico Golde
2006-02-15 17:05 ` Greg KH
2006-02-15 21:41 ` Matthew Martin
2006-02-15 23:01 ` Nishanth Aravamudan
2006-02-15 23:16 ` Håkon Løvdal
2006-02-15 23:27 ` Greg KH
2006-02-15 23:31 ` Randy.Dunlap
2006-02-15 23:37 ` Håkon Løvdal
2006-02-16  0:38 ` Greg KH [this message]
2006-02-16  1:49 ` Matthew Martin
2006-02-16 14:51 ` Matthew Martin
2006-02-16 15:43 ` Nishanth Aravamudan
2006-02-16 17:20 ` Randy.Dunlap
2006-02-17 21:53 ` Alexey Dobriyan
2006-02-18 11:48 ` walter harms
2006-02-18 16:28 ` Greg KH

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=20060216003831.GA30735@kroah.com \
    --to=greg@kroah.com \
    --cc=kernel-janitors@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.