summaryrefslogtreecommitdiff
path: root/drivers/staging/rts5208
diff options
context:
space:
mode:
authorEva Rachel Retuya <eraretuya@gmail.com>2016-02-27 20:39:24 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-11 22:09:09 -0800
commit7586170c84de561c7bf05dd0df0c4bf9786417d5 (patch)
treea698c5792626b23e9aad5c0cdbff6d80f380f77c /drivers/staging/rts5208
parenteff8bf82432b6a3cd367e765a1806ebe3d1556e8 (diff)
staging: rts5208: simplify NULL tests
Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for consistency. Coccinelle semantic patch used: @@ identifier func; expression x; statement Z; @@ x = func(...); if ( ( + ! x - == NULL | + ! - NULL == x ) ) Z Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rts5208')
-rw-r--r--drivers/staging/rts5208/ms.c8
-rw-r--r--drivers/staging/rts5208/rtsx.c6
-rw-r--r--drivers/staging/rts5208/rtsx_scsi.c22
-rw-r--r--drivers/staging/rts5208/sd.c4
-rw-r--r--drivers/staging/rts5208/spi.c2
-rw-r--r--drivers/staging/rts5208/xd.c4
6 files changed, 23 insertions, 23 deletions
diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 44d79ef75298..b8c9337b514f 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -1039,7 +1039,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
}
buf = kmalloc(64 * 512, GFP_KERNEL);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return STATUS_ERROR;
}
@@ -2405,7 +2405,7 @@ static int ms_init_l2p_tbl(struct rtsx_chip *chip)
size = ms_card->segment_cnt * sizeof(struct zone_entry);
ms_card->segment = vzalloc(size);
- if (ms_card->segment == NULL) {
+ if (!ms_card->segment) {
rtsx_trace(chip);
return STATUS_FAIL;
}
@@ -2614,7 +2614,7 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no)
if (segment->l2p_table == NULL) {
segment->l2p_table = vmalloc(table_size * 2);
- if (segment->l2p_table == NULL) {
+ if (!segment->l2p_table) {
rtsx_trace(chip);
goto BUILD_FAIL;
}
@@ -2623,7 +2623,7 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no)
if (segment->free_table == NULL) {
segment->free_table = vmalloc(MS_FREE_TABLE_CNT * 2);
- if (segment->free_table == NULL) {
+ if (!segment->free_table) {
rtsx_trace(chip);
goto BUILD_FAIL;
}
diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 62204b5bcdf4..5ebaf8c97887 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -880,7 +880,7 @@ static int rtsx_probe(struct pci_dev *pci,
memset(dev, 0, sizeof(struct rtsx_dev));
dev->chip = kzalloc(sizeof(struct rtsx_chip), GFP_KERNEL);
- if (dev->chip == NULL) {
+ if (!dev->chip) {
err = -ENOMEM;
goto errout;
}
@@ -901,7 +901,7 @@ static int rtsx_probe(struct pci_dev *pci,
(unsigned int)pci_resource_len(pci, 0));
dev->addr = pci_resource_start(pci, 0);
dev->remap_addr = ioremap_nocache(dev->addr, pci_resource_len(pci, 0));
- if (dev->remap_addr == NULL) {
+ if (!dev->remap_addr) {
dev_err(&pci->dev, "ioremap error\n");
err = -ENXIO;
goto errout;
@@ -916,7 +916,7 @@ static int rtsx_probe(struct pci_dev *pci,
dev->rtsx_resv_buf = dmam_alloc_coherent(&pci->dev, RTSX_RESV_BUF_LEN,
&dev->rtsx_resv_buf_addr, GFP_KERNEL);
- if (dev->rtsx_resv_buf == NULL) {
+ if (!dev->rtsx_resv_buf) {
dev_err(&pci->dev, "alloc dma buffer fail\n");
err = -ENXIO;
goto errout;
diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c
index 16284ca4cad0..d2031044ea34 100644
--- a/drivers/staging/rts5208/rtsx_scsi.c
+++ b/drivers/staging/rts5208/rtsx_scsi.c
@@ -507,7 +507,7 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip)
}
buf = vmalloc(scsi_bufflen(srb));
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -644,7 +644,7 @@ static int request_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip)
}
buf = vmalloc(scsi_bufflen(srb));
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -792,7 +792,7 @@ static int mode_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip)
#endif
buf = kmalloc(dataSize, GFP_KERNEL);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -1017,7 +1017,7 @@ static int read_format_capacity(struct scsi_cmnd *srb, struct rtsx_chip *chip)
buf_len = (scsi_bufflen(srb) > 12) ? 0x14 : 12;
buf = kmalloc(buf_len, GFP_KERNEL);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -1096,7 +1096,7 @@ static int read_capacity(struct scsi_cmnd *srb, struct rtsx_chip *chip)
}
buf = kmalloc(8, GFP_KERNEL);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -1206,7 +1206,7 @@ static int write_eeprom(struct scsi_cmnd *srb, struct rtsx_chip *chip)
len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb),
len);
buf = vmalloc(len);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -1315,7 +1315,7 @@ static int write_mem(struct scsi_cmnd *srb, struct rtsx_chip *chip)
len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len);
buf = vmalloc(len);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -1410,7 +1410,7 @@ static int trace_msg_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
clear = srb->cmnd[2];
buf = vmalloc(scsi_bufflen(srb));
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -2030,7 +2030,7 @@ static int write_phy_register(struct scsi_cmnd *srb, struct rtsx_chip *chip)
len);
buf = vmalloc(len);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -2186,7 +2186,7 @@ static int write_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip)
len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len);
buf = vmalloc(len);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -2290,7 +2290,7 @@ static int write_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip)
len = (u8)min_t(unsigned int, scsi_bufflen(srb), len);
buf = vmalloc(len);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index 1612610c1f56..87d697623cba 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -4588,7 +4588,7 @@ int sd_execute_read_data(struct scsi_cmnd *srb, struct rtsx_chip *chip)
cmd[4] = srb->cmnd[6];
buf = kmalloc(data_len, GFP_KERNEL);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
@@ -4871,7 +4871,7 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip)
u8 *buf;
buf = kmalloc(data_len, GFP_KERNEL);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return TRANSPORT_ERROR;
}
diff --git a/drivers/staging/rts5208/spi.c b/drivers/staging/rts5208/spi.c
index 2e1e6cb6b070..26eb2a184f91 100644
--- a/drivers/staging/rts5208/spi.c
+++ b/drivers/staging/rts5208/spi.c
@@ -662,7 +662,7 @@ int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
}
buf = kmalloc(SF_PAGE_LEN, GFP_KERNEL);
- if (buf == NULL) {
+ if (!buf) {
rtsx_trace(chip);
return STATUS_ERROR;
}
diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
index 10fea7bb8f30..fe84f757d575 100644
--- a/drivers/staging/rts5208/xd.c
+++ b/drivers/staging/rts5208/xd.c
@@ -1435,7 +1435,7 @@ static int xd_build_l2p_tbl(struct rtsx_chip *chip, int zone_no)
if (zone->l2p_table == NULL) {
zone->l2p_table = vmalloc(2000);
- if (zone->l2p_table == NULL) {
+ if (!zone->l2p_table) {
rtsx_trace(chip);
goto Build_Fail;
}
@@ -1444,7 +1444,7 @@ static int xd_build_l2p_tbl(struct rtsx_chip *chip, int zone_no)
if (zone->free_table == NULL) {
zone->free_table = vmalloc(XD_FREE_TABLE_CNT * 2);
- if (zone->free_table == NULL) {
+ if (!zone->free_table) {
rtsx_trace(chip);
goto Build_Fail;
}