From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mark Brown <broonie@kernel.org>,
kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] regmap: Adjust five checks for null pointers in __regmap_init()
Date: Thu, 25 May 2017 22:08:25 +0200 [thread overview]
Message-ID: <4bca89e5-9d86-4ec9-1105-cc921c50f910@users.sourceforge.net> (raw)
In-Reply-To: <7d7b8131-5aea-cb33-994f-f410dc7cd615@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 25 May 2017 21:52:42 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written !…
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/base/regmap/regmap.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 096499e1f223..2b1f073b72a6 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -618,7 +618,7 @@ struct regmap *__regmap_init(struct device *dev,
goto err;
map = kzalloc(sizeof(*map), GFP_KERNEL);
- if (map == NULL) {
+ if (!map) {
ret = -ENOMEM;
goto err;
}
@@ -918,7 +918,7 @@ struct regmap *__regmap_init(struct device *dev,
goto err_map;
map->work_buf = kzalloc(map->format.buf_size, GFP_KERNEL);
- if (map->work_buf == NULL) {
+ if (!map->work_buf) {
ret = -ENOMEM;
goto err_map;
}
@@ -993,7 +993,7 @@ struct regmap *__regmap_init(struct device *dev,
}
new = kzalloc(sizeof(*new), GFP_KERNEL);
- if (new == NULL) {
+ if (!new) {
ret = -ENOMEM;
goto err_range;
}
@@ -1014,10 +1014,10 @@ struct regmap *__regmap_init(struct device *dev,
goto err_range;
}
- if (map->selector_work_buf == NULL) {
+ if (!map->selector_work_buf) {
map->selector_work_buf =
kzalloc(map->format.buf_size, GFP_KERNEL);
- if (map->selector_work_buf == NULL) {
+ if (!map->selector_work_buf) {
ret = -ENOMEM;
goto err_range;
}
--
2.13.0
prev parent reply other threads:[~2017-05-25 20:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-25 20:05 [PATCH 0/2] regmap: Adjustments for two function implementations SF Markus Elfring
2017-05-25 20:07 ` [PATCH 1/2] regmap: Delete an error message for a failed memory allocation in regmap_bulk_write() SF Markus Elfring
2018-02-26 11:18 ` Applied "regmap: Remove unnecessary printk for failed allocation" to the regmap tree Mark Brown
2017-05-25 20:08 ` SF Markus Elfring [this message]
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=4bca89e5-9d86-4ec9-1105-cc921c50f910@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--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
Powered by JetHome