From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AIpwx4/TrOlDP3rThxEThWk692upO79CBwL8sfVW5oshyA8MjZBqds/wRKfsopvvlUEyAGUxeLkf ARC-Seal: i=1; a=rsa-sha256; t=1522391594; cv=none; d=google.com; s=arc-20160816; b=wRV/tADXAtum52ZPIPwx4iz+2T00S6N0iijBYeX0C3nHQDbp65G+KYSGQjOd87FRob EThsPrQWWvjHkb56oWrkHcrrq+doEB2GJbjMzPFhQywTorCJAAfsJ1dfWxLT3uF+MdX7 2ba3gBdfWRXgMV9paTaQ3Gd6mTCkH5EkG8RVH47o1lBr5xOW2aHTsFgkel53aA28BrNa S+vM/bdvXM3uKHl0m7CXAwzShs9iyAj14sS+ujfg40cKbdizT55IlH20snDIqpvav33D Va8YWLzYQB8GUAJycejUdHUpqm0x8ZKZ7PZ6GFF1FsKAIRcQG7pSJvEhqN1Y88ff7Y9T JWNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:subject:cc:to:from:date :delivered-to:list-id:list-subscribe:list-unsubscribe:list-help :list-post:precedence:mailing-list:arc-authentication-results; bh=rtD7+ZpVkBq9qZp2nYhM+pdaSeJnvU08oAkLCESqL3Y=; b=fz424vVRXFNbDyxwlMmrdsjrGMWJeVx6mkES007yvmGg1VVPMVmnooTJVaWpIjm5k6 TI2dQFk/vXBdfRI3o8/WTUJbKXxFo7qqwgOmGr1hNgdo5bWTbGbnxQxEbbtEU04TH3q2 T1FZddoSSIUTUjahL7vbRa2LzD8OAwgevG53mXFp5B8QcNwz/erWO6PmRVrLGKR9ZKnV nImVJI10IrF6Td0//1qiXVmBhdq7GP503UH5t1SAC/v4+ME+MfpXbLN67ND7l5yk//qa shc61tHl3dai5G4EbXm3PgFhGlCVR1z7385DAd2Tr65uWipJzS96CwjuQ9DbNTLfJZGq sD5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of kernel-hardening-return-12831-gregkh=linuxfoundation.org@lists.openwall.com designates 195.42.179.200 as permitted sender) smtp.mailfrom=kernel-hardening-return-12831-gregkh=linuxfoundation.org@lists.openwall.com Authentication-Results: mx.google.com; spf=pass (google.com: domain of kernel-hardening-return-12831-gregkh=linuxfoundation.org@lists.openwall.com designates 195.42.179.200 as permitted sender) smtp.mailfrom=kernel-hardening-return-12831-gregkh=linuxfoundation.org@lists.openwall.com Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: X-IronPort-AV: E=Sophos;i="5.48,380,1517871600"; d="scan'208";a="260356484" 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1596343288243285153?= X-GMAIL-MSGID: =?utf-8?q?1596343288243285153?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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; }