[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>
This commit is contained in:
committed by
James Bottomley
parent
8d1a006049
commit
f1663ad5db
@ -379,21 +379,37 @@ static struct bin_attribute sysfs_sfp_attr = {
|
|||||||
.read = qla2x00_sysfs_read_sfp,
|
.read = qla2x00_sysfs_read_sfp,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct sysfs_entry {
|
||||||
|
char *name;
|
||||||
|
struct bin_attribute *attr;
|
||||||
|
int is4GBp_only;
|
||||||
|
} bin_file_entries[] = {
|
||||||
|
{ "fw_dump", &sysfs_fw_dump_attr, },
|
||||||
|
{ "nvram", &sysfs_nvram_attr, },
|
||||||
|
{ "optrom", &sysfs_optrom_attr, },
|
||||||
|
{ "optrom_ctl", &sysfs_optrom_ctl_attr, },
|
||||||
|
{ "vpd", &sysfs_vpd_attr, 1 },
|
||||||
|
{ "sfp", &sysfs_sfp_attr, 1 },
|
||||||
|
{ 0 },
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
|
qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
|
||||||
{
|
{
|
||||||
struct Scsi_Host *host = ha->host;
|
struct Scsi_Host *host = ha->host;
|
||||||
|
struct sysfs_entry *iter;
|
||||||
|
int ret;
|
||||||
|
|
||||||
sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
|
for (iter = bin_file_entries; iter->name; iter++) {
|
||||||
sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
|
if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)))
|
||||||
sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
|
continue;
|
||||||
sysfs_create_bin_file(&host->shost_gendev.kobj,
|
|
||||||
&sysfs_optrom_ctl_attr);
|
ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
|
||||||
if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
|
iter->attr);
|
||||||
sysfs_create_bin_file(&host->shost_gendev.kobj,
|
if (ret)
|
||||||
&sysfs_vpd_attr);
|
qla_printk(KERN_INFO, ha,
|
||||||
sysfs_create_bin_file(&host->shost_gendev.kobj,
|
"Unable to create sysfs %s binary attribute "
|
||||||
&sysfs_sfp_attr);
|
"(%d).\n", iter->name, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,17 +417,14 @@ void
|
|||||||
qla2x00_free_sysfs_attr(scsi_qla_host_t *ha)
|
qla2x00_free_sysfs_attr(scsi_qla_host_t *ha)
|
||||||
{
|
{
|
||||||
struct Scsi_Host *host = ha->host;
|
struct Scsi_Host *host = ha->host;
|
||||||
|
struct sysfs_entry *iter;
|
||||||
|
|
||||||
|
for (iter = bin_file_entries; iter->name; iter++) {
|
||||||
|
if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)))
|
||||||
|
continue;
|
||||||
|
|
||||||
sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
|
|
||||||
sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
|
|
||||||
sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
|
|
||||||
sysfs_remove_bin_file(&host->shost_gendev.kobj,
|
|
||||||
&sysfs_optrom_ctl_attr);
|
|
||||||
if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
|
|
||||||
sysfs_remove_bin_file(&host->shost_gendev.kobj,
|
sysfs_remove_bin_file(&host->shost_gendev.kobj,
|
||||||
&sysfs_vpd_attr);
|
iter->attr);
|
||||||
sysfs_remove_bin_file(&host->shost_gendev.kobj,
|
|
||||||
&sysfs_sfp_attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ha->beacon_blink_led == 1)
|
if (ha->beacon_blink_led == 1)
|
||||||
|
Reference in New Issue
Block a user