]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: rts5208: simplify NULL tests
authorEva Rachel Retuya <eraretuya@gmail.com>
Sat, 27 Feb 2016 12:39:24 +0000 (20:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Mar 2016 06:09:09 +0000 (22:09 -0800)
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>
drivers/staging/rts5208/ms.c
drivers/staging/rts5208/rtsx.c
drivers/staging/rts5208/rtsx_scsi.c
drivers/staging/rts5208/sd.c
drivers/staging/rts5208/spi.c
drivers/staging/rts5208/xd.c

index 44d79ef75298d3e69d00321f6be5ab567e9952f1..b8c9337b514f8632e2dd189954ccbf1443485282 100644 (file)
@@ -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;
                }
index 62204b5bcdf402898625c20e1cc5a58fa6852c84..5ebaf8c978878dec4ba024ccbfb78c46dcdfc8d8 100644 (file)
@@ -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;
index 16284ca4cad08ab1c097baf42f7adf7e40de5340..d2031044ea349270f7e1ca7630aaa9994e103cdb 100644 (file)
@@ -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;
        }
index 1612610c1f565d1fcf0d6a01b2f4486e40da8327..87d697623cba03f9c9f528b56629ebb47fb7f8ee 100644 (file)
@@ -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;
                }
index 2e1e6cb6b070e67227e2e23351375694cd97b6cd..26eb2a184f9127f6b183602de98a3226f6b31f8c 100644 (file)
@@ -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;
        }
index 10fea7bb8f3088d395a2a1d4402783ae921e50fd..fe84f757d5759800b109a9ffff2f532f316e87b4 100644 (file)
@@ -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;
                }