[PATCH] Improve error messages in scsi_sysfs_add_sdev()

From: Hannes Reinecke
Date: Sun Feb 24 2008 - 21:39:28 EST


When we fail to add a device to the driver core, only the very
helpful message 'error X' is displayed.
Print out some more meaningful messages.

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
drivers/scsi/scsi_sysfs.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 4db0fed..8f674ac 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -830,12 +830,14 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
error = device_add(&sdev->sdev_gendev);
if (error) {
put_device(sdev->sdev_gendev.parent);
- printk(KERN_INFO "error 1\n");
+ sdev_printk(KERN_INFO, sdev,
+ "failed to add device: %d\n", error);
return error;
}
error = device_add(&sdev->sdev_dev);
if (error) {
- printk(KERN_INFO "error 2\n");
+ sdev_printk(KERN_INFO, sdev,
+ "failed to add class device: %d\n", error);
goto clean_device;
}

--
1.5.3.2


--------------050407030103030004010009
Content-Type: text/x-patch;
name="0004-Remove-stale-put_device-from-scsi_sysfs_add_sdev.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename*0="0004-Remove-stale-put_device-from-scsi_sysfs_add_sdev.patch"