mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Simon Sandström" <simon@nikanor.nu>
To: gregkh@linuxfoundation.org
Cc: simon@nikanor.nu, jeremy@azazel.net, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/7] staging: kpc2000: simplify comparisons to NULL in core.c
Date: Tue,  4 Jun 2019 00:29:10 +0200	[thread overview]
Message-ID: <20190603222916.20698-2-simon@nikanor.nu> (raw)
In-Reply-To: <20190603222916.20698-1-simon@nikanor.nu>

Fixes checkpatch.pl warnings "Comparison to NULL could be written [...]"
and "Comparisons should place the constant on the right side of the
test".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
---
 drivers/staging/kpc2000/kpc2000/core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
index 7f257c21e0cc..356a272c0b9c 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -319,7 +319,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 	 * Step 1: Allocate a struct for the pcard
 	 */
 	pcard = kzalloc(sizeof(struct kp2000_device), GFP_KERNEL);
-	if (NULL == pcard) {
+	if (!pcard) {
 		dev_err(&pdev->dev,
 			"probe: failed to allocate private card data\n");
 		return -ENOMEM;
@@ -363,7 +363,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 	reg_bar_phys_len = pci_resource_len(pcard->pdev, REG_BAR);
 
 	pcard->regs_bar_base = ioremap_nocache(reg_bar_phys_addr, PAGE_SIZE);
-	if (NULL == pcard->regs_bar_base) {
+	if (!pcard->regs_bar_base) {
 		dev_err(&pcard->pdev->dev,
 			"probe: REG_BAR could not remap memory to virtual space\n");
 		err = -ENODEV;
@@ -396,7 +396,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 
 	pcard->dma_bar_base = ioremap_nocache(dma_bar_phys_addr,
 					      dma_bar_phys_len);
-	if (NULL == pcard->dma_bar_base) {
+	if (!pcard->dma_bar_base) {
 		dev_err(&pcard->pdev->dev,
 			"probe: DMA_BAR could not remap memory to virtual space\n");
 		err = -ENODEV;
@@ -546,7 +546,7 @@ static void kp2000_pcie_remove(struct pci_dev *pdev)
 
 	dev_dbg(&pdev->dev, "kp2000_pcie_remove(pdev=%p)\n", pdev);
 
-	if (pcard == NULL)
+	if (!pcard)
 		return;
 
 	mutex_lock(&pcard->sem);
@@ -555,12 +555,12 @@ static void kp2000_pcie_remove(struct pci_dev *pdev)
 	sysfs_remove_files(&(pdev->dev.kobj), kp_attr_list);
 	free_irq(pcard->pdev->irq, pcard);
 	pci_disable_msi(pcard->pdev);
-	if (pcard->dma_bar_base != NULL) {
+	if (pcard->dma_bar_base) {
 		iounmap(pcard->dma_bar_base);
 		pci_release_region(pdev, DMA_BAR);
 		pcard->dma_bar_base = NULL;
 	}
-	if (pcard->regs_bar_base != NULL) {
+	if (pcard->regs_bar_base) {
 		iounmap(pcard->regs_bar_base);
 		pci_release_region(pdev, REG_BAR);
 		pcard->regs_bar_base = NULL;
-- 
2.20.1


  reply	other threads:[~2019-06-03 22:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 22:29 [PATCH 0/7] staging: kpc2000: various minor checkpatch fixes Simon Sandström
2019-06-03 22:29 ` Simon Sandström [this message]
2019-06-03 22:29 ` [PATCH 2/7] staging: kpc2000: remove unnecessary parentheses in core.c Simon Sandström
2019-06-03 22:29 ` [PATCH 3/7] staging: kpc2000: remove unnecessary oom message " Simon Sandström
2019-06-03 22:29 ` [PATCH 4/7] staging: kpc2000: use __func__ in debug messages " Simon Sandström
2019-06-06 12:55   ` Greg KH
2019-06-10  7:20     ` Simon Sandström
2019-06-10  7:49       ` Greg KH
2019-06-03 22:29 ` [PATCH 5/7] staging: kpc2000: remove unnecessary include " Simon Sandström
2019-06-03 22:29 ` [PATCH 6/7] staging: kpc2000: use sizeof(var) in kzalloc call Simon Sandström
2019-06-03 22:29 ` [PATCH 7/7] staging: kpc2000: fix incorrect code comment in core.c Simon Sandström
2019-06-06 11:34   ` Dan Carpenter

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=20190603222916.20698-2-simon@nikanor.nu \
    --to=simon@nikanor.nu \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeremy@azazel.net \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®