All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] kernel[v2]: fix ifnullfree.cocci warnings
Date: Wed, 02 Dec 2020 16:05:25 +0800	[thread overview]
Message-ID: <20201202080525.GA22671@9017113e4702> (raw)
In-Reply-To: <202012021616.gPrU53Bb-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2086 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Yuan Liu <yuan1.liu@intel.com>
CC: "Qin, Chao" <chao.qin@intel.com>
CC: Yonghua Huang <yonghua.huahng@intel.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
CC: kvm(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

drivers/uio/uio_pci_generic.c:247:2-7: WARNING: NULL check before some freeing functions is not needed.
drivers/uio/uio_pci_generic.c:264:2-7: WARNING: NULL check before some freeing functions is not needed.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

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

Fixes: 709a04896cb6 ("kernel[v2]: extend uio driver to supports msix")
CC: Yuan Liu <yuan1.liu@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://github.com/intel/linux-intel-lts.git 5.4/yocto
head:   709a04896cb6ab56a8ce54575f2cc4d346d71dea
commit: 709a04896cb6ab56a8ce54575f2cc4d346d71dea [11/11] kernel[v2]: extend uio driver to supports msix
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago

Please take the patch only if it's a positive warning. Thanks!

 uio_pci_generic.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/uio/uio_pci_generic.c
+++ b/drivers/uio/uio_pci_generic.c
@@ -243,8 +243,7 @@ static int probe(struct pci_dev *pdev,
 
 err_register:
 #ifdef CONFIG_PCI_MSI
-	if (gdev->msix_info.entries != NULL)
-		kfree(gdev->msix_info.entries);
+	kfree(gdev->msix_info.entries);
 #endif
 	kfree(gdev);
 err_alloc:
@@ -260,8 +259,7 @@ static void remove(struct pci_dev *pdev)
 	uio_unregister_device(&gdev->info);
 	pci_disable_device(pdev);
 #ifdef CONFIG_PCI_MSI
-	if (gdev->msix_info.entries != NULL)
-		kfree(gdev->msix_info.entries);
+	kfree(gdev->msix_info.entries);
 #endif
 	kfree(gdev);
 }

  reply	other threads:[~2020-12-02  8:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02  8:05 [intel-linux-intel-lts:5.4/yocto 11/11] drivers/uio/uio_pci_generic.c:247:2-7: WARNING: NULL check before some freeing functions is not needed kernel test robot
2020-12-02  8:05 ` kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-09 11:05 kernel test robot
2021-03-09 11:05 ` [PATCH] kernel[v2]: fix ifnullfree.cocci warnings kernel test robot
2021-04-12 22:02 [intel-linux-intel-lts:5.4/yocto 11/11] drivers/uio/uio_pci_generic.c:247:2-7: WARNING: NULL check before some freeing functions is not needed kernel test robot
2021-04-12 22:02 ` [PATCH] kernel[v2]: fix ifnullfree.cocci warnings kernel test robot

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=20201202080525.GA22671@9017113e4702 \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.