[PATCH 3/15] lpfc 8.1.0 : Return -EINVAL, -EPERM, and -EIO instead of 0 from sysfs callbacks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Return -EINVAL, -EPERM, and -EIO  instead of 0 from sysfs callbacks


Signed-off-by: James Smart <James.Smart@xxxxxxxxxx>

--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -251,8 +251,6 @@ lpfc_board_online_show(struct class_devi
 	struct Scsi_Host *host = class_to_shost(cdev);
 	struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];
 
-	if (!phba) return 0;
-
 	if (phba->fc_flag & FC_OFFLINE_MODE)
 		return snprintf(buf, PAGE_SIZE, "0\n");
 	else
@@ -269,7 +267,7 @@ lpfc_board_online_store(struct class_dev
 	int val=0, status=0;
 
 	if (sscanf(buf, "%d", &val) != 1)
-		return 0;
+		return -EINVAL;
 
 	init_completion(&online_compl);
 
@@ -283,7 +281,7 @@ lpfc_board_online_store(struct class_dev
 	if (!status)
 		return strlen(buf);
 	else
-		return 0;
+		return -EIO;
 }
 
 
@@ -299,7 +297,7 @@ lpfc_##attr##_show(struct class_device *
 		return snprintf(buf, PAGE_SIZE, "%d\n",\
 				phba->cfg_##attr);\
 	}\
-	return 0;\
+	return -EPERM;\
 }
 
 #define lpfc_param_store(attr, minval, maxval)	\
@@ -314,13 +312,11 @@ lpfc_##attr##_store(struct class_device 
 	if (sscanf(buf, "0x%x", &val) != 1)\
 		if (sscanf(buf, "%d", &val) != 1)\
 			return -EINVAL;\
-	if (phba){\
-		if (val >= minval && val <= maxval) {\
-			phba->cfg_##attr = val;\
-			return strlen(buf);\
-		}\
+	if (val >= minval && val <= maxval) {\
+		phba->cfg_##attr = val;\
+		return strlen(buf);\
 	}\
-	return 0;\
+	return -EINVAL;\
 }
 
 #define LPFC_ATTR_R_NOINIT(name, desc) \
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux