linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Antonino Daplas <adaplas@pol.net>,
	linux-fbdev-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] drivers/video/pmag-ba-fb.c: Improve diagnostics
Date: Wed, 19 Sep 2007 17:24:12 -0700	[thread overview]
Message-ID: <20070919172412.725508d0.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64N.0709181314300.9650@blysk.ds.pg.gda.pl>

On Tue, 18 Sep 2007 13:18:34 +0100 (BST)
"Maciej W. Rozycki" <macro@linux-mips.org> wrote:

>  Add error messages to the probe call.
> 
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
> ---
>  While they may rarely trigger, they may be useful when something weird is 
> going on.  Also this is good style.
> 
>  This is an updated version that addresses an issue raised by Mariusz 
> Kozlowski for the sibling patch.  Checked with checkpatch.pl.
> 
>  Please apply.
> 
>   Maciej
> 
> patch-mips-2.6.23-rc5-20070904-pmag-ba-err-2
> diff -up --recursive --new-file linux-mips-2.6.23-rc5-20070904.macro/drivers/video/pmag-ba-fb.c linux-mips-2.6.23-rc5-20070904/drivers/video/pmag-ba-fb.c
> --- linux-mips-2.6.23-rc5-20070904.macro/drivers/video/pmag-ba-fb.c	2007-02-21 05:56:47.000000000 +0000
> +++ linux-mips-2.6.23-rc5-20070904/drivers/video/pmag-ba-fb.c	2007-09-18 10:56:51.000000000 +0000
> @@ -147,16 +147,23 @@ static int __init pmagbafb_probe(struct 
>  	resource_size_t start, len;
>  	struct fb_info *info;
>  	struct pmagbafb_par *par;
> +	int err = 0;

This initialisation to zero is not good.

Because if some error-path code forgot to do `err = -EFOO' then probe()
will return zero and the driver will leave things in half-initialised state
and will then proceed as if things had succeeded.  It will crash.

So it's better to leave this local uninitialised, because we really want to
get that compiler warning if someone forgot to set the return value.

I made that change, but am too stupid to be able to work out how to create
a config which will let me compile this thing.

akpm:/usr/src/25> grep PMAG arch/arm/configs/*
akpm:/usr/src/25> 

bah.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  reply	other threads:[~2007-09-20  0:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-17 16:45 [PATCH] drivers/video/pmag-ba-fb.c: Improve diagnostics Maciej W. Rozycki
2007-09-18 12:18 ` Maciej W. Rozycki
2007-09-20  0:24   ` Andrew Morton [this message]
2007-09-20  6:16     ` Martin Michlmayr
2007-09-20 12:52     ` Maciej W. Rozycki
2007-09-20 13:43       ` Satyam Sharma
2007-09-20 13:54         ` Markus Gothe
2007-09-20 14:07           ` Satyam Sharma
2007-09-20 14:04         ` Maciej W. Rozycki
2007-09-20 14:24           ` Satyam Sharma

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=20070919172412.725508d0.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adaplas@pol.net \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).