aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2006-10-13 12:33:37 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-10-25 18:12:54 -0400
commitf1663ad5dbb801e03c4c99c24d698ad5dba9aaff (patch)
tree593a9b00f34073d1d0982857e181ec4bb60d554e
parent8d1a006049ff1c084d57fbea1106ecad3455bd27 (diff)
[SCSI] qla2xxx: Check return value of sysfs_create_bin_file() usage.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index ee75a71f3c66..285c8e8ff1a0 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -379,21 +379,37 @@ static struct bin_attribute sysfs_sfp_attr = {
379 .read = qla2x00_sysfs_read_sfp, 379 .read = qla2x00_sysfs_read_sfp,
380}; 380};
381 381
382static struct sysfs_entry {
383 char *name;
384 struct bin_attribute *attr;
385 int is4GBp_only;
386} bin_file_entries[] = {
387 { "fw_dump", &sysfs_fw_dump_attr, },
388 { "nvram", &sysfs_nvram_attr, },
389 { "optrom", &sysfs_optrom_attr, },
390 { "optrom_ctl", &sysfs_optrom_ctl_attr, },
391 { "vpd", &sysfs_vpd_attr, 1 },
392 { "sfp", &sysfs_sfp_attr, 1 },
393 { 0 },
394};
395
382void 396void
383qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha) 397qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
384{ 398{
385 struct Scsi_Host *host = ha->host; 399 struct Scsi_Host *host = ha->host;
400 struct sysfs_entry *iter;
401 int ret;
386 402
387 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); 403 for (iter = bin_file_entries; iter->name; iter++) {
388 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); 404 if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)))
389 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr); 405 continue;
390 sysfs_create_bin_file(&host->shost_gendev.kobj, 406
391 &sysfs_optrom_ctl_attr); 407 ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
392 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { 408 iter->attr);
393 sysfs_create_bin_file(&host->shost_gendev.kobj, 409 if (ret)
394 &sysfs_vpd_attr); 410 qla_printk(KERN_INFO, ha,
395 sysfs_create_bin_file(&host->shost_gendev.kobj, 411 "Unable to create sysfs %s binary attribute "
396 &sysfs_sfp_attr); 412 "(%d).\n", iter->name, ret);
397 } 413 }
398} 414}
399 415
@@ -401,17 +417,14 @@ void
401qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) 417qla2x00_free_sysfs_attr(scsi_qla_host_t *ha)
402{ 418{
403 struct Scsi_Host *host = ha->host; 419 struct Scsi_Host *host = ha->host;
420 struct sysfs_entry *iter;
421
422 for (iter = bin_file_entries; iter->name; iter++) {
423 if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)))
424 continue;
404 425
405 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
406 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
407 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
408 sysfs_remove_bin_file(&host->shost_gendev.kobj,
409 &sysfs_optrom_ctl_attr);
410 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
411 sysfs_remove_bin_file(&host->shost_gendev.kobj,
412 &sysfs_vpd_attr);
413 sysfs_remove_bin_file(&host->shost_gendev.kobj, 426 sysfs_remove_bin_file(&host->shost_gendev.kobj,
414 &sysfs_sfp_attr); 427 iter->attr);
415 } 428 }
416 429
417 if (ha->beacon_blink_led == 1) 430 if (ha->beacon_blink_led == 1)