mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Helge Deller <deller@gmx.de>
Cc: Libin <huawei.libin@huawei.com>,
	linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org,
	James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH] [workqueue] check values of pwq and wq in print_worker_info() before use
Date: Tue, 1 Oct 2013 18:47:02 -0400	[thread overview]
Message-ID: <20131001224702.GB28618@mtj.dyndns.org> (raw)
In-Reply-To: <20131001224023.GA28618@mtj.dyndns.org>

On Tue, Oct 01, 2013 at 06:40:23PM -0400, Tejun Heo wrote:
> Because it is using probe_kernel_read() and such test wouldn't mean
> anything?  It may be NULL, it may be 1 or full Fs.  NULL is just one
> of many illegal pointers which may happen.  Why add code which doesn't
> achieve anything when you're explicitly trying to access pointers
> which you know could be invalid?  Why is that "clean"?  Is "if (p)
> kfree(p)" cleaner than "kfree(p)"?

Here's one general rule of thumb for "cleanliness" - try to do the
minimal because that's something many people can agree on.  If people
do stuff which aren't necessary, naturally different people would have
different opinions on what's cleaner / better and inevitably end up
with different choices as the choices made are functionally superflous
none would fail and we'll end up with various variants for the same
thing for no good reason, which is messy.  Adding if (p) in front of
probe_kernel_read(p) is inherently superflous and you wouldn't have
any way to enforce or even encourage such practice and the end result
would inevitably be if (p) being sprayed randomly, which is the
opposite of cleanliness.

So, no, please don't add random tests which aren't essential.  It is
inherently messy thing to do.

Thanks.

-- 
tejun

  reply	other threads:[~2013-10-01 22:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-01 20:35 Helge Deller
2013-10-01 20:43 ` Tejun Heo
2013-10-01 20:53   ` Helge Deller
2013-10-01 21:03     ` Tejun Heo
2013-10-01 21:07       ` Tejun Heo
2013-10-01 22:34         ` Helge Deller
2013-10-01 22:40           ` Tejun Heo
2013-10-01 22:47             ` Tejun Heo [this message]
2013-10-01 21:40   ` James Bottomley
2013-10-01 22:07     ` Helge Deller
2013-10-01 22:50       ` James Bottomley
2013-10-02  0:41         ` John David Anglin
2013-10-02  1:58         ` John David Anglin
2013-10-02  8:28         ` Helge Deller

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=20131001224702.GB28618@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=deller@gmx.de \
    --cc=huawei.libin@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®