diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/scsi/ses.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/scsi/ses.c')
-rw-r--r-- | drivers/scsi/ses.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 55b034b72708..7f5a6a86f820 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c | |||
@@ -21,6 +21,7 @@ | |||
21 | **----------------------------------------------------------------------------- | 21 | **----------------------------------------------------------------------------- |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/slab.h> | ||
24 | #include <linux/module.h> | 25 | #include <linux/module.h> |
25 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
26 | #include <linux/enclosure.h> | 27 | #include <linux/enclosure.h> |
@@ -448,13 +449,17 @@ static void ses_match_to_enclosure(struct enclosure_device *edev, | |||
448 | .addr = 0, | 449 | .addr = 0, |
449 | }; | 450 | }; |
450 | 451 | ||
451 | buf = scsi_get_vpd_page(sdev, 0x83); | 452 | buf = kmalloc(INIT_ALLOC_SIZE, GFP_KERNEL); |
452 | if (!buf) | 453 | if (!buf || scsi_get_vpd_page(sdev, 0x83, buf, INIT_ALLOC_SIZE)) |
453 | return; | 454 | goto free; |
454 | 455 | ||
455 | ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0); | 456 | ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0); |
456 | 457 | ||
457 | vpd_len = ((buf[2] << 8) | buf[3]) + 4; | 458 | vpd_len = ((buf[2] << 8) | buf[3]) + 4; |
459 | kfree(buf); | ||
460 | buf = kmalloc(vpd_len, GFP_KERNEL); | ||
461 | if (!buf ||scsi_get_vpd_page(sdev, 0x83, buf, vpd_len)) | ||
462 | goto free; | ||
458 | 463 | ||
459 | desc = buf + 4; | 464 | desc = buf + 4; |
460 | while (desc < buf + vpd_len) { | 465 | while (desc < buf + vpd_len) { |
@@ -591,8 +596,6 @@ static int ses_intf_add(struct device *cdev, | |||
591 | ses_dev->page10_len = len; | 596 | ses_dev->page10_len = len; |
592 | buf = NULL; | 597 | buf = NULL; |
593 | } | 598 | } |
594 | kfree(hdr_buf); | ||
595 | |||
596 | scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL); | 599 | scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL); |
597 | if (!scomp) | 600 | if (!scomp) |
598 | goto err_free; | 601 | goto err_free; |
@@ -604,6 +607,8 @@ static int ses_intf_add(struct device *cdev, | |||
604 | goto err_free; | 607 | goto err_free; |
605 | } | 608 | } |
606 | 609 | ||
610 | kfree(hdr_buf); | ||
611 | |||
607 | edev->scratch = ses_dev; | 612 | edev->scratch = ses_dev; |
608 | for (i = 0; i < components; i++) | 613 | for (i = 0; i < components; i++) |
609 | edev->component[i].scratch = scomp + i; | 614 | edev->component[i].scratch = scomp + i; |