All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Romer <benjamin.romer@unisys.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	<devel@driverdev.osuosl.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<sparmaintainer@unisys.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: unisys: use common return path
Date: Tue, 1 Dec 2015 11:16:16 -0500	[thread overview]
Message-ID: <565DC7D0.3000307@unisys.com> (raw)
In-Reply-To: <20151201155724.GG18797@mwanda>

On 12/01/2015 10:57 AM, Dan Carpenter wrote:
> What I meant was that I'm generally opposed to "common exit paths".
> Mixing all the exit paths together often makes the code more complicated
> and leads to errors.  That makes sense from a common sense perspective
> that doing many things is more difficult than doing one thing?  Anyway
> it's easy enough to verify empirically that this style is bug prone.
>
> On the other hand there are times where all exit paths need to unlock or
> to free a variable and in those cases using a common exit path makes
> sense.  Just don't standardize on "Every function should only have a
> single return".
>

That works for me. Mainly my issue with it is that I've spent a lot of 
time trying to eliminate "goto Away" code from the drivers, so I'd 
rather not put any back if possible.

>>
>> If we *have* to change it
>
> I don't think we have to change it at all.  Using direct returns makes
> finding locking bugs easier for static checkers.
>

That's true, and I think the code is fine as it is.

>> 		spin_unlock_irqrestore(&devdata->priv_lock, flags);
>
> This is a bug.
>

Indeed, but I'd rather not have any of these changes made anyway. This 
function isn't broken so it doesn't need to be fixed.

-- Ben

  reply	other threads:[~2015-12-01 16:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01  6:15 [PATCH] staging: unisys: use common return path Sudip Mukherjee
2015-12-01  8:00 ` Dan Carpenter
2015-12-01  8:06   ` Dan Carpenter
2015-12-01  9:57     ` Sudip Mukherjee
2015-12-01 16:05       ` Dan Carpenter
2015-12-02  4:49         ` Sudip Mukherjee
2015-12-01 14:54   ` Ben Romer
2015-12-01 15:57     ` Dan Carpenter
2015-12-01 16:16       ` Ben Romer [this message]
2015-12-02  5:01         ` Sudip Mukherjee
2015-12-02  5:02       ` Sudip Mukherjee
2015-12-02  6:20         ` Dan Carpenter

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=565DC7D0.3000307@unisys.com \
    --to=benjamin.romer@unisys.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparmaintainer@unisys.com \
    --cc=sudipm.mukherjee@gmail.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.