All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <WHarms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: script to find incorrect tests on unsigneds
Date: Sat, 19 Apr 2008 13:29:53 +0000	[thread overview]
Message-ID: <4809F3D1.7040606@bfs.de> (raw)
In-Reply-To: <4808C90A.5040600@tiscali.nl>

i guess the idea of using unsigned int = -1 is to set all bit.
so you do not need something linux =UINT_MAX. That would fail if someone
changes int to long and not UINT_MAX.

IMHO the use of 'result' is not need. snd_sbdsp_get_byte will return int
i am worried because snd_sbdsp_get_byte() may return -ENODEV. what will
short do and why ?

maybe the autor wants this (not tested):


static int snd_sbdsp_version(sb_t * chip)
{
	int major,minor;
	if ( snd_sbdsp_command(chip, SB_DSP_GET_VERSION) =0)
	 return -ENODEV;

        major=snd_sbdsp_get_byte(chip) ;
	if( major<0)
		return -ENODEV;

	minor=snd_sbdsp_get_byte(chip) ;
	if( minor <0)
		return -ENODEV;

	return (major<<8)|minor ;

}

btw: is ANYONE using sb isa card these days ?

re,
 wh



Julia Lawall wrote:
> Does the initialization of result in the following code serve any purpose?
> 
> sound/isa/sb/sb_common.c:
> 
>  static int snd_sbdsp_version(struct snd_sb * chip)
>  {
>         unsigned int result = -ENODEV;
> 
>         snd_sbdsp_command(chip, SB_DSP_GET_VERSION);
>         result = (short) snd_sbdsp_get_byte(chip) << 8;
> 
> If result is unsigned, its value will never be -ENODEV, and anyway the 
> value is overwritten before it is ever used.
> 
> There are a couple of other cases like this.  There are also 
> initializations of unsigned variables to -1, which seem prevalent 
> enough that perhaps they serve some purpose.
> 
> julia
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 

  parent reply	other threads:[~2008-04-19 13:29 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18 16:15 script to find incorrect tests on unsigneds Roel Kluin
2008-04-18 19:08 ` Julia Lawall
2008-04-19 14:05   ` esp_scsi incorrect unsigned test Matthew Wilcox
2008-04-19 14:05     ` Matthew Wilcox
2008-04-19 14:16     ` James Bottomley
2008-04-19 14:16       ` James Bottomley
2008-04-20  0:59       ` David Miller
2008-04-20  0:59         ` David Miller
2008-04-19 14:17   ` u14-3f " Matthew Wilcox
2008-04-19 14:17     ` Matthew Wilcox
     [not found]   ` <Pine.LNX.4.64.0804182101200.14832-QfmoRoYWmW9knbxzx/v8hQ@public.gmane.org>
2008-04-19 14:24     ` script to find incorrect tests on unsigneds Matthew Wilcox
2008-04-19 14:24       ` Matthew Wilcox
2008-04-19 14:49   ` Matthew Wilcox
2008-04-19 14:49     ` Matthew Wilcox
2008-04-18 19:36 ` Julia Lawall
2008-04-19 13:29 ` walter harms [this message]
2008-04-19 13:43 ` Matthew Wilcox
2008-04-19 15:20 ` Julia Lawall
2008-04-19 15:43 ` Julia Lawall
2008-04-22 21:06 ` Julia Lawall
2008-04-22 21:28 ` Roel Kluin
2008-04-23  5:47 ` Julia Lawall
2008-04-23  9:26 ` Roel Kluin
2008-04-23  9:30 ` Roel Kluin
2008-04-23  9:54 ` Julia Lawall
2008-04-23 10:02 ` Julia Lawall
2008-04-23 10:26 ` Roel Kluin
2008-04-23 14:02 ` Roel Kluin
2008-04-23 14:05 ` Roel Kluin
2008-04-23 14:11 ` Roel Kluin
2008-04-23 14:24 ` Julia Lawall
2008-04-23 16:01 ` Roel Kluin
2008-04-23 17:59 ` Roel Kluin
2008-04-23 18:58 ` Julia Lawall
2008-04-23 19:12 ` Julia Lawall
2008-04-23 19:36 ` Roel Kluin

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=4809F3D1.7040606@bfs.de \
    --to=wharms@bfs.de \
    --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.