diff options
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index a69013a9c39a..45c2ba7e94c2 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -245,8 +245,6 @@ lpfc_board_online_show(struct class_device *cdev, char *buf) | |||
245 | struct Scsi_Host *host = class_to_shost(cdev); | 245 | struct Scsi_Host *host = class_to_shost(cdev); |
246 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 246 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; |
247 | 247 | ||
248 | if (!phba) return 0; | ||
249 | |||
250 | if (phba->fc_flag & FC_OFFLINE_MODE) | 248 | if (phba->fc_flag & FC_OFFLINE_MODE) |
251 | return snprintf(buf, PAGE_SIZE, "0\n"); | 249 | return snprintf(buf, PAGE_SIZE, "0\n"); |
252 | else | 250 | else |
@@ -263,7 +261,7 @@ lpfc_board_online_store(struct class_device *cdev, const char *buf, | |||
263 | int val=0, status=0; | 261 | int val=0, status=0; |
264 | 262 | ||
265 | if (sscanf(buf, "%d", &val) != 1) | 263 | if (sscanf(buf, "%d", &val) != 1) |
266 | return 0; | 264 | return -EINVAL; |
267 | 265 | ||
268 | init_completion(&online_compl); | 266 | init_completion(&online_compl); |
269 | 267 | ||
@@ -277,7 +275,7 @@ lpfc_board_online_store(struct class_device *cdev, const char *buf, | |||
277 | if (!status) | 275 | if (!status) |
278 | return strlen(buf); | 276 | return strlen(buf); |
279 | else | 277 | else |
280 | return 0; | 278 | return -EIO; |
281 | } | 279 | } |
282 | 280 | ||
283 | 281 | ||
@@ -293,7 +291,7 @@ lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | |||
293 | return snprintf(buf, PAGE_SIZE, "%d\n",\ | 291 | return snprintf(buf, PAGE_SIZE, "%d\n",\ |
294 | phba->cfg_##attr);\ | 292 | phba->cfg_##attr);\ |
295 | }\ | 293 | }\ |
296 | return 0;\ | 294 | return -EPERM;\ |
297 | } | 295 | } |
298 | 296 | ||
299 | #define lpfc_param_store(attr, minval, maxval) \ | 297 | #define lpfc_param_store(attr, minval, maxval) \ |
@@ -308,13 +306,11 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | |||
308 | if (sscanf(buf, "0x%x", &val) != 1)\ | 306 | if (sscanf(buf, "0x%x", &val) != 1)\ |
309 | if (sscanf(buf, "%d", &val) != 1)\ | 307 | if (sscanf(buf, "%d", &val) != 1)\ |
310 | return -EINVAL;\ | 308 | return -EINVAL;\ |
311 | if (phba){\ | 309 | if (val >= minval && val <= maxval) {\ |
312 | if (val >= minval && val <= maxval) {\ | 310 | phba->cfg_##attr = val;\ |
313 | phba->cfg_##attr = val;\ | 311 | return strlen(buf);\ |
314 | return strlen(buf);\ | ||
315 | }\ | ||
316 | }\ | 312 | }\ |
317 | return 0;\ | 313 | return -EINVAL;\ |
318 | } | 314 | } |
319 | 315 | ||
320 | #define LPFC_ATTR_R_NOINIT(name, desc) \ | 316 | #define LPFC_ATTR_R_NOINIT(name, desc) \ |