Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	kbuild-all@01.org, Kees Cook <keescook@chromium.org>,
	Lukas Wunner <lukas@wunner.de>, Laura Abbott <labbott@redhat.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-hardening@lists.openwall.com,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [PATCH] gpio: fix ifnullfree.cocci warnings (fwd)
Date: Fri, 30 Mar 2018 08:32:56 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1803300829580.2870@hadrien> (raw)

From: Fengguang Wu <fengguang.wu@intel.com>

NULL check before kfree is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: ad85ae608fe0 ("gpio: Remove VLA from gpiolib")
CC: Laura Abbott <labbott@redhat.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>

---

url:
https://github.com/0day-ci/linux/commits/Laura-Abbott/gpio-Remove-VLA-from-gpiolib/20180330-065639
base:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
for-next

 gpiolib.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2758,8 +2758,7 @@ int gpiod_get_array_value_complex(bool r

 		ret = gpio_chip_get_multiple(chip, mask, bits);
 		if (ret) {
-			if (slowpath)
-				kfree(slowpath);
+			kfree(slowpath);
 			return ret;
 		}

@@ -2774,8 +2773,7 @@ int gpiod_get_array_value_complex(bool r
 			trace_gpio_value(desc_to_gpio(desc), 1, value);
 		}

-		if (slowpath)
-			kfree(slowpath);
+		kfree(slowpath);
 	}
 	return 0;
 }
@@ -3020,8 +3018,7 @@ int gpiod_set_array_value_complex(bool r
 		if (count != 0)
 			gpio_chip_set_multiple(chip, mask, bits);

-		if (slowpath)
-			kfree(slowpath);
+		kfree(slowpath);
 	}
 	return 0;
 }

             reply	other threads:[~2018-03-30  6:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30  6:32 Julia Lawall [this message]
2018-04-02  8:31 ` [PATCH] gpio: fix ifnullfree.cocci warnings Lukas Wunner
2018-04-02  9:04   ` Julia Lawall

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.1803300829580.2870@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=kbuild-all@01.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=lukas@wunner.de \
    /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