Commit 7586170c authored by Eva Rachel Retuya's avatar Eva Rachel Retuya Committed by Greg Kroah-Hartman
Browse files

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: default avatarEva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eff8bf82
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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;
		}
+3 −3
Original line number Diff line number Diff line
@@ -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;
+11 −11
Original line number Diff line number Diff line
@@ -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;
	}
+2 −2
Original line number Diff line number Diff line
@@ -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;
		}
+1 −1
Original line number Diff line number Diff line
@@ -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;
	}
Loading