Received: by 10.213.65.68 with SMTP id h4csp20209imn; Thu, 29 Mar 2018 23:34:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx484dchRye4vkM1eCFarjx9fKCpb3RresjEtWTyVZPZehHvZP3ASLIzXa6jyJZAhf5OixBJy X-Received: by 10.98.103.199 with SMTP id t68mr8824204pfj.24.1522391662252; Thu, 29 Mar 2018 23:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522391662; cv=none; d=google.com; s=arc-20160816; b=zbJZmkUhHKzEm901OfRzemQdzDoFuXGnybsOpu1ejglNiho5Mv7R5tzxvTtpn0IA/e sfGjLVssCqKSU2DB+bR78qDce3H9IA0MWQF+tbtG4s3C5Mt6LLDA5kaLHGEy9+uA1W4W /cAS5Qu/7NHTosdRdSnFMjdqrxLMD76gYdkI9kU/4HkSOUva3qJQCy+6D1PGlejB9gmQ 1a5/xPemIA7WvAv0q63gGtYjgNsCi3E6CrTSG/5whJjKTQv+QO4/TQFGNzgcasxLk95l n6QIt7Sn+kL4baHW33rIWXknz99jAIE/14G4D3soNDcgAoNmKicWY8Cw3ZTWL7ysXJeP TH5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :subject:cc:to:from:date:arc-authentication-results; bh=rtD7+ZpVkBq9qZp2nYhM+pdaSeJnvU08oAkLCESqL3Y=; b=Cmk8e5tHVtjjX9R0pkvRcLq079tnWti/TOaGmSwFoak8B0oWgPiCo+EbcmWZWh1rr0 S0iAOe5r+EYkncZ7oym5xbMPHOW8CNhI6SJPqB2lcmNCAApPAhiHFRA5WGe18uJAszYm xdj0yhNE4fXcuZDiktqC56coByymcW+XhpR2kKD6wX1laqxn78TtIW8gdsKbgH96CzU5 QRyWFQ2L9m5Hox74qKbacQE46oNsU4FXH1MgfU16njfYD3lb0nYwmn9c76pFbYWS2xJE tbjCDVbEEIqVyZqc8vAj+j2g1iN6z6JdwO/NtqskYqaF9a7kwPBLZn2XoNZE4UVd9SVx Y+eA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si7667250pla.382.2018.03.29.23.34.07; Thu, 29 Mar 2018 23:34:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751167AbeC3GdA (ORCPT + 99 others); Fri, 30 Mar 2018 02:33:00 -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 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) --- 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; }