From fca9f04d460bf7c6af397dd994f1d81a3037f9dc Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Mon, 27 Feb 2012 03:08:54 -0800 Subject: [SCSI] qla4xxx: Export CHAP index as sysfs attribute Signed-off-by: Mike Christie Signed-off-by: Vikas Chaudhary Reviewed-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/qla4xxx/ql4_mbx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/scsi/qla4xxx/ql4_mbx.c') diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index eaf2185..71331e3 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c @@ -1426,8 +1426,8 @@ exit_set_chap: * match is found. If a match is not found then add the entry in FLASH and * return the index at which entry is written in the FLASH. **/ -static int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username, - char *password, int bidi, uint16_t *chap_index) +int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username, + char *password, int bidi, uint16_t *chap_index) { int i, rval; int free_index = -1; @@ -1446,6 +1446,11 @@ static int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username, return QLA_ERROR; } + if (!username || !password) { + ql4_printk(KERN_ERR, ha, "Do not have username and psw\n"); + return QLA_ERROR; + } + mutex_lock(&ha->chap_sem); for (i = 0; i < max_chap_entries; i++) { chap_table = (struct ql4_chap_table *)ha->chap_list + i; -- cgit v1.1