Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 755c0d06 authored by James.Smart@Emulex.Com's avatar James.Smart@Emulex.Com Committed by James Bottomley
Browse files

[SCSI] lpfc: Return -EINVAL, -EPERM, and -EIO instead of 0 from sysfs callbacks

parent 964b77e7
Loading
Loading
Loading
Loading
+7 −11
Original line number Original line Diff line number Diff line
@@ -245,8 +245,6 @@ lpfc_board_online_show(struct class_device *cdev, char *buf)
	struct Scsi_Host *host = class_to_shost(cdev);
	struct Scsi_Host *host = class_to_shost(cdev);
	struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];
	struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];


	if (!phba) return 0;

	if (phba->fc_flag & FC_OFFLINE_MODE)
	if (phba->fc_flag & FC_OFFLINE_MODE)
		return snprintf(buf, PAGE_SIZE, "0\n");
		return snprintf(buf, PAGE_SIZE, "0\n");
	else
	else
@@ -263,7 +261,7 @@ lpfc_board_online_store(struct class_device *cdev, const char *buf,
	int val=0, status=0;
	int val=0, status=0;


	if (sscanf(buf, "%d", &val) != 1)
	if (sscanf(buf, "%d", &val) != 1)
		return 0;
		return -EINVAL;


	init_completion(&online_compl);
	init_completion(&online_compl);


@@ -277,7 +275,7 @@ lpfc_board_online_store(struct class_device *cdev, const char *buf,
	if (!status)
	if (!status)
		return strlen(buf);
		return strlen(buf);
	else
	else
		return 0;
		return -EIO;
}
}




@@ -293,7 +291,7 @@ lpfc_##attr##_show(struct class_device *cdev, char *buf) \
		return snprintf(buf, PAGE_SIZE, "%d\n",\
		return snprintf(buf, PAGE_SIZE, "%d\n",\
				phba->cfg_##attr);\
				phba->cfg_##attr);\
	}\
	}\
	return 0;\
	return -EPERM;\
}
}


#define lpfc_param_store(attr, minval, maxval)	\
#define lpfc_param_store(attr, minval, maxval)	\
@@ -308,13 +306,11 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \
	if (sscanf(buf, "0x%x", &val) != 1)\
	if (sscanf(buf, "0x%x", &val) != 1)\
		if (sscanf(buf, "%d", &val) != 1)\
		if (sscanf(buf, "%d", &val) != 1)\
			return -EINVAL;\
			return -EINVAL;\
	if (phba){\
	if (val >= minval && val <= maxval) {\
	if (val >= minval && val <= maxval) {\
		phba->cfg_##attr = val;\
		phba->cfg_##attr = val;\
		return strlen(buf);\
		return strlen(buf);\
	}\
	}\
	}\
	return -EINVAL;\
	return 0;\
}
}


#define LPFC_ATTR_R_NOINIT(name, desc) \
#define LPFC_ATTR_R_NOINIT(name, desc) \