All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Czerwacki, Eial" <eial.czerwacki@sap.com>
Cc: "linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
	SAP vSMP Linux Maintainer <linux.vsmp@sap.com>
Subject: Re: [RFC] staging/vSMP: new driver
Date: Thu, 17 Mar 2022 13:27:41 +0300	[thread overview]
Message-ID: <20220317102741.GZ3293@kadam> (raw)
In-Reply-To: <20220317101942.GX3293@kadam>

On Thu, Mar 17, 2022 at 01:19:43PM +0300, Dan Carpenter wrote:
> "new driver" is too vague.  What is the driver for?
> 
> You need a README or a TODO which explains how to move the driver out of
> staging and into the main kernel.
> 
> Run the patch through scripts/checkpatch.pl --strict.  You don't have
> to fix everything because this is staging but a bunch of the style
> issues are easy to fix so we may as well just do it.
> 
> There are a number of bugs and style issues.
> 1) Find and replace every -1 with a define or a proper error code
> 2) Never do assignments inside of a condition
> 3) Do success handling instead of error handling.  Try to return errors

I meant the other way around.  Do error handling.  If you return an
error directly then code looks like this:

	success;
	if (fail)
		cleanup;
	success;
	success;
	if (fail)
		more cleanup;

Otherwise if you have two successes then it starts getting indented a
lot.

	success;
	if (success)
		success;
		success;
		if (success)
			success;
		else
			more cleanup;
	else
		cleanup;

Pasta.

regards,
dan carpenter


  reply	other threads:[~2022-03-17 10:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 18:13 [RFC] staging/vSMP: new driver Czerwacki, Eial
2022-03-16 18:31 ` Randy Dunlap
2022-03-16 18:57   ` Czerwacki, Eial
2022-03-17  7:23 ` Greg KH
2022-03-17  7:34   ` Czerwacki, Eial
2022-03-17  7:51     ` Greg KH
2022-03-17  8:17       ` Czerwacki, Eial
2022-03-17  8:35         ` Greg KH
2022-03-17  8:52           ` Czerwacki, Eial
2022-03-17  8:59             ` Greg KH
2022-03-17  9:04               ` Czerwacki, Eial
2022-04-20 11:18                 ` Czerwacki, Eial
2022-04-20 11:24                   ` Greg KH
2022-04-20 11:38                     ` Czerwacki, Eial
2022-04-20 11:42                       ` Greg KH
2022-04-20 11:57                         ` Czerwacki, Eial
2022-04-20 12:17                           ` Greg KH
2022-04-20 12:36                             ` Czerwacki, Eial
2022-04-20 14:24                               ` Greg KH
2022-03-17  7:24 ` Greg KH
2022-03-17  7:38   ` Czerwacki, Eial
2022-03-17  7:52     ` Greg KH
2022-03-17 10:19 ` Dan Carpenter
2022-03-17 10:27   ` Dan Carpenter [this message]
2022-03-17 13:41   ` Czerwacki, Eial
2022-03-17 13:56     ` Dan Carpenter
2022-03-17 14:05       ` Czerwacki, Eial

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=20220317102741.GZ3293@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=eial.czerwacki@sap.com \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux.vsmp@sap.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.