From: Rogier Wolff <R.E.Wolff@BitWizard.nl>
To: Pavel Machek <pavel@suse.cz>
Cc: Christoph Hellwig <hch@infradead.org>,
davej@codemonkey.org.uk,
kernel list <linux-kernel@vger.kernel.org>,
paul.devriendt@amd.com, aj@suse.de
Subject: Re: Cpufreq for opteron
Date: Sat, 23 Aug 2003 09:55:21 +0200 [thread overview]
Message-ID: <20030823095521.B14519@bitwizard.nl> (raw)
In-Reply-To: <20030822195427.GB2306@elf.ucw.cz>
On Fri, Aug 22, 2003 at 09:54:27PM +0200, Pavel Machek wrote:
> Hi!
>
> > > +/* driver entry point for term */
> > > +static void __exit
> > > +drv_exit(void)
> > > +{
> > > + dprintk(KERN_INFO PFX "drv_exit\n");
> > > +
> > > + cpufreq_unregister_driver(&cpufreq_amd64_driver);
> > > + if (ppst) {
> > > + kfree(ppst);
> >
> > kfree(NULL) is fine.
> >
> > > + ppst = 0;
> >
> > this should be ppst = NULL but in fact is completly superflous as
> > the module is gone afterwards.
>
> Ok.
Guys, good programming practise would leave this in. If you want,
you could add a comment that in the current code, this is superfluous.
In the current code it is also not performance critical. So to maintain
good programming practise I would recommend to leave the ppst = NULL.
The code might get copied somewhere else. In that case the ppst=NULL
will indicate that it's pointing nowhere. Also, this will prevent
the bug from becoming a bug: The developer will immediately see that
he's made a mistake and fix it before it becomes a real bug. But
if you leave the dangling pointer around, you will address memory
that until recently contained believable data. So it will work
most of the time. Only when an interrupt comes by that allocates
memory and actually writes the relevant parts will you get problems.
That might be quite rare and very difficult to track down.
In writing code, simple bugs are not a problem. These are the bugs
that show up while compiling the code, or in first testing.
You should try to prevent the hard bugs with good programming
practise. These are the bugs where you get a report: My server
locks up every day or two. It's too long to sit by the machine
to wait for it to happen, it's too long to log everything, but
it's way too short to say: Sorry, you'll have to live with it.
Roger.
--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
**** "Linux is like a wigwam - no windows, no gates, apache inside!" ****
next prev parent reply other threads:[~2003-08-23 8:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-22 13:59 Cpufreq for opteron Pavel Machek
2003-08-22 14:43 ` Dave Jones
2003-08-22 19:55 ` Pavel Machek
2003-08-22 20:05 ` Pavel Machek
2003-08-26 23:02 ` Dominik Brodowski
2003-08-22 14:52 ` Christoph Hellwig
2003-08-22 14:55 ` Dave Jones
2003-08-22 19:54 ` Pavel Machek
2003-08-23 7:55 ` Rogier Wolff [this message]
2003-08-23 17:50 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2003-08-22 16:25 Andi Kleen
2003-08-22 20:09 paul.devriendt
2003-08-25 8:46 ` Pavel Machek
2003-08-25 13:30 ` Valdis.Kletnieks
2003-08-24 15:31 paul.devriendt
2003-08-25 9:35 ` Pavel Machek
[not found] <99F2150714F93F448942F9A9F112634C080EF006@txexmtae.amd.com.suse.lists.linux.kernel>
[not found] ` <20030825084616.GC403@elf.ucw.cz.suse.lists.linux.kernel>
2003-08-25 10:56 ` Andi Kleen
2003-08-25 12:53 paul.devriendt
2003-08-25 13:51 ` Pavel Machek
2003-08-25 14:09 paul.devriendt
2003-08-27 0:43 paul.devriendt
2003-08-27 5:13 ` Dominik Brodowski
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=20030823095521.B14519@bitwizard.nl \
--to=r.e.wolff@bitwizard.nl \
--cc=aj@suse.de \
--cc=davej@codemonkey.org.uk \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.devriendt@amd.com \
--cc=pavel@suse.cz \
/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