From patchwork Fri Mar 30 06:32:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 893109 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lip6.fr Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40CBd86vLsz9s15 for ; Fri, 30 Mar 2018 17:33:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750741AbeC3Gc7 (ORCPT ); Fri, 30 Mar 2018 02:32:59 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:11779 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750725AbeC3Gc6 (ORCPT ); Fri, 30 Mar 2018 02:32:58 -0400 X-IronPort-AV: E=Sophos;i="5.48,380,1517871600"; d="scan'208";a="260356484" Received: from ip-146.net-89-2-7.rev.numericable.fr (HELO [192.168.0.15]) ([89.2.7.146]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Mar 2018 08:32:57 +0200 Date: Fri, 30 Mar 2018 08:32:56 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Laura Abbott cc: Linus Walleij , kbuild-all@01.org, Kees Cook , Lukas Wunner , Laura Abbott , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Rasmus Villemoes Subject: [PATCH] gpio: fix ifnullfree.cocci warnings (fwd) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Fengguang Wu NULL check before kfree is not needed. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: ad85ae608fe0 ("gpio: Remove VLA from gpiolib") CC: Laura Abbott Signed-off-by: Fengguang Wu Signed-off-by: Julia Lawall --- 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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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; }