mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Derek Perrin <d.roc16@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: firmware: edd: fixed coding style errors
Date: Sun, 22 Dec 2013 14:13:39 -0800	[thread overview]
Message-ID: <1387750419.22671.25.camel@joe-AO722> (raw)
In-Reply-To: <1387747039-14098-1-git-send-email-d.roc16@gmail.com>

On Sun, 2013-12-22 at 15:17 -0600, Derek Perrin wrote:
> Fixed coding style errors. Spaces, tab and parenthesis errors.

There's a real error in this patch.

When you do whitespace only changes, please
verify that the old and new object files produced
are unchanged.

One trivial bit too,

> diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
[]
> @@ -62,8 +62,8 @@ struct edd_device {
>  
>  struct edd_attribute {
>  	struct attribute attr;
> -	ssize_t(*show) (struct edd_device * edev, char *buf);
> -	int (*test) (struct edd_device * edev);
> +	ssize_t(*show) (struct edd_device *edev, char *buf);
> +	int (*test) (struct edd_device *edev);

I think most prefer function pointer prototypes like:

	size_t (*show)(struct edd_device *edev, char *buf);
	int (*test)(struct edd_device *edev);

> @@ -791,7 +791,7 @@ edd_exit(void)
>  	struct edd_device *edev;
>  
>  	for (i = 0; i < edd_num_devices(); i++) {
> -		if ((edev = edd_devices[i]))
> +		if ((edev == edd_devices[i]))
>  			edd_device_unregister(edev);
>  	}
>  	kset_unregister(edd_kset);

This is wrong.
It's an assignment in the block and it's important.

This could be rewritten as:

	for (i = 0; i < edd_num_devices(); i++) {
		edev = edd_devices[i];
		if (edev)
			edd_device_unregister(edev);
	}

or just remove the temporary.


  reply	other threads:[~2013-12-22 22:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-22 21:17 Derek Perrin
2013-12-22 22:13 ` Joe Perches [this message]
2013-12-24  0:53   ` Derek Perrin
2013-12-24  6:43     ` Joe Perches
2013-12-25 10:19       ` [PATCH v2] " Derek Perrin
2013-12-25  5:21         ` [PATCH] checkpatch: Add tests for function pointer style misuses Joe Perches

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=1387750419.22671.25.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=d.roc16@gmail.com \
    --cc=linux-kernel@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®