All of lore.kernel.org
 help / color / mirror / Atom feed
From: Diego Liziero <diegoliz@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: [PATCH] drivers/regulator: fix when type is different from REGULATOR_VOLTAGE
Date: Tue, 14 Apr 2009 01:04:47 +0000	[thread overview]
Message-ID: <49E3E12F.20808@gmail.com> (raw)


From: Diego Liziero <diegoliz@gmail.com>

When regulator_desc->type is something different from REGULATOR_VOLTAGE or REGULATOR_CURRENT
the if should probably return ERR_PTR(-EINVAL)

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

@@ expression E; constant C; @@
(
- !E = C
+ E != C
)

Signed-off-by: Diego Liziero <diegoliz@gmail.com>

---
diff = 
--- ./drivers/regulator/core.c	2009-04-13 01:21:28.000000000 +0200
+++ /tmp/cocci-output-26453-5bbb39-core.c	2009-04-13 20:38:48.000000000 +0200
@@ -2001,8 +2001,8 @@ struct regulator_dev *regulator_register
 	if (regulator_desc->name = NULL || regulator_desc->ops = NULL)
 		return ERR_PTR(-EINVAL);
 
-	if (!regulator_desc->type = REGULATOR_VOLTAGE &&
-	    !regulator_desc->type = REGULATOR_CURRENT)
+	if (regulator_desc->type != REGULATOR_VOLTAGE &&
+	    regulator_desc->type != REGULATOR_CURRENT)
 		return ERR_PTR(-EINVAL);
 
 	if (!init_data)

             reply	other threads:[~2009-04-14  1:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14  1:04 Diego Liziero [this message]
2009-04-14 10:02 ` [PATCH] drivers/regulator: fix when type is different from Mark Brown
2009-04-15 15:53 ` Liam Girdwood

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=49E3E12F.20808@gmail.com \
    --to=diegoliz@gmail.com \
    --cc=kernel-janitors@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 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.