All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
	ide <linux-ide@vger.kernel.org>,
	bzolnier@gmail.com
Subject: Re: [PATCH] IDE: fix PCI must_checks
Date: Thu, 5 Apr 2007 13:03:30 -0700	[thread overview]
Message-ID: <20070405130330.f5f8a2a6.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070405121302.1206e748@the-village.bc.nu>

On Thu, 5 Apr 2007 12:13:02 +0100
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> On Wed, 4 Apr 2007 21:37:04 -0700
> Randy Dunlap <randy.dunlap@oracle.com> wrote:
> 
> > From: Randy Dunlap <randy.dunlap@oracle.com>
> > 
> > Check PCI interface function results for errors in drivers/ide/pci.
> > 
> > drivers/ide/pci/cs5530.c:244: warning: ignoring return value of 'pci_set_mwi', declared with attribute warn_unused_result
> 
> NAK (again) 

Disagree.

> The bug is in pci_set_mwi, it should not force return value checking.
> Please fix that instead.

You don't describe your reasoning, but I will assume that it is as follows:

pci_set_mwi() is an advisory thing, and on certain platforms it might fail
to set the cacheline size to the desired number.  This is not a fatal error
and the driver can successfully run at a lesser performance level.

If that description is accurate then I'd contend that pci_set_mwi() is
misdesigned.  It should not be returning a negative error code for
something which is not an error.

The changes we should make are

a) rename pci_set_pwi() to pci_try_set_mwi()

b) make pci_try_set_mwi() return a positive, non-zero code when the
   attempt to set the cacheline size failed.  And make it return a
   negative error code when fatal errors occur.

This way

a) drivers which _do_ care about whether or not the cacheline size was
   set successfully can test for it or generate warnings and

b) we can tell when pci_try_set_mwi() encountered a fatal error for
   other reasons.


Now this may all sound excessively anal, but it is simply the correct design.
And one of the reasons for adding the __must_check annotation is to weed out
design errors.  Simply turning the thing off is a step backwards.

And we *need* to be excessively anal in the PCI setup code.  We have metric
shitloads of bugs due to problems in that area, and the more formality and
error handling and error reporting we can get in there the better off we
will be.



  reply	other threads:[~2007-04-05 20:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05  4:37 [PATCH] IDE: fix PCI must_checks Randy Dunlap
2007-04-05 11:13 ` Alan Cox
2007-04-05 20:03   ` Andrew Morton [this message]
2007-04-05 20:16     ` Alan Cox
2007-04-05 21:20       ` Andrew Morton
2007-04-06  5:05         ` Randy Dunlap
2007-04-06 17:41           ` Alan Cox
2007-04-16 17:19         ` [RFC/PATCH -mm] add pci_try_set_mwi Randy Dunlap
2007-04-16 17:21         ` Randy Dunlap

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=20070405130330.f5f8a2a6.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    /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.