Skip to contentSkip to conversation

libata-scsi: Delete an unnecessary variable in ata_scsi_slave_config()

PATCH In review SF Markus Elfring 2 participants 2 messages Feb 16, 2018 – Feb 18, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata-scsi: Delete an unnecessary variable in ata_scsi_slave_config()

From: Markus Elfring <[email protected]>
Date: Fri, 16 Feb 2018 18:19:13 +0100

* Return a result code without storing it in an intermediate variable.

* Reduce the needed source code.

---
 drivers/ata/libata-scsi.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/ata/libata-scsi.c +1 -6
index 66be961c93a4..93456cff051b 100644
@@ -1345,14 +1345,9 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
 {
 	struct ata_port *ap = ata_shost_to_port(sdev->host);
 	struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
-	int rc = 0;
 
 	ata_scsi_sdev_config(sdev);
-
-	if (dev)
-		rc = ata_scsi_dev_config(sdev, dev);
-
-	return rc;
+	return dev ? ata_scsi_dev_config(sdev, dev) : 0;
 }
 
 /**
Signature · 1 line
2.16.1
#1 lore raw
Quoted 19 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 16 Feb 2018 18:19:13 +0100

* Return a result code without storing it in an intermediate variable.

* Reduce the needed source code.

---
 drivers/ata/libata-scsi.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/ata/libata-scsi.c +0 -0
index 66be961c93a4..93456cff051b 100644
@@ -1345,14 +1345,9 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
 {
 	struct ata_port *ap = ata_shost_to_port(sdev->host);

drivers/ata/libata-scsi.c int ata_scsi_slave_config(struct scsi_device *sdev) · line 1350

Quoted 10 lines
drivers/ata/libata-scsi.c +1 -6
 	struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
-	int rc = 0;
 
 	ata_scsi_sdev_config(sdev);
-
-	if (dev)
-		rc = ata_scsi_dev_config(sdev, dev);
-
-	return rc;
+	return dev ? ata_scsi_dev_config(sdev, dev) : 0;

Let's do the following instead.

	if (dev)
		return ata_scsi..;
	else
		return 0;

Thanks.

Signature · 1 line
tejun