From: Julia Lawall <julia.lawall@lip6.fr>
To: Siddhi Dave <d.sandy5990@gmail.com>
Cc: lidza.louina@gmail.com, markh@compro.net,
gregkh@linuxfoundation.org,
driverdev-devel@linuxdriverproject.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] Staging: dgnc: Clean up Macros
Date: Sun, 16 Oct 2016 15:30:57 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1610161525490.2207@hadrien> (raw)
In-Reply-To: <20161016124231.GA18162@siddhi-home-laptop>
On Sun, 16 Oct 2016, Siddhi Dave wrote:
> Fix checkpatch warning: Macros with flow control statements should be avoided
>
> Because Macros with flow control statements (goto and return) are
> not very nice to read as any flow movement is unexpected.
>
> Signed-off-by: Siddhi Dave <d.sandy5990@gmail.com>
> ---
> drivers/staging/dgnc/dgnc_sysfs.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
> index 290bf6e..0767740 100644
> --- a/drivers/staging/dgnc/dgnc_sysfs.c
> +++ b/drivers/staging/dgnc/dgnc_sysfs.c
> @@ -90,16 +90,16 @@ void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver)
> driver_remove_file(driverfs, &driver_attr_pollrate);
> }
>
> -#define DGNC_VERIFY_BOARD(p, bd) \
> - do { \
> - if (!p) \
> - return 0; \
> - \
> - bd = dev_get_drvdata(p); \
> - if (!bd || bd->magic != DGNC_BOARD_MAGIC) \
> - return 0; \
> - if (bd->state != BOARD_READY) \
> - return 0; \
> +#define DGNC_VERIFY_BOARD(p, bd)
> +do {
> + if (!p)
> + return 0;
> +
> + bd = dev_get_drvdata(p);
> + if (!bd || bd->magic != DGNC_BOARD_MAGIC)
> + return 0;
> + if (bd->state != BOARD_READY)
> + return 0;
> } while (0)
This does not look correct. You are still sort of defining a macro,
except that you have dropped all of the \s. A macro has to be defined on
a single line, or a line continued with \, so this would cause major
syntax errors. I think that someone else worked on similar code and found
that some of the tests were also not needed in the context in which this
code is used.
julia
>
> static ssize_t vpd_show(struct device *p, struct device_attribute *attr,
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161016124231.GA18162%40siddhi-home-laptop.
> For more options, visit https://groups.google.com/d/optout.
>
next prev parent reply other threads:[~2016-10-16 13:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-16 12:42 Siddhi Dave
2016-10-16 13:30 ` Julia Lawall [this message]
2016-10-16 15:09 ` Greg KH
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=alpine.DEB.2.20.1610161525490.2207@hadrien \
--to=julia.lawall@lip6.fr \
--cc=d.sandy5990@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=lidza.louina@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markh@compro.net \
--cc=outreachy-kernel@googlegroups.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 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®