Loading drivers/scsi/ses.c +14 −9 Original line number Diff line number Diff line Loading @@ -416,7 +416,7 @@ static int ses_intf_add(struct class_device *cdev, int i, j, types, len, components = 0; int err = -ENOMEM; struct enclosure_device *edev; struct ses_component *scomp; struct ses_component *scomp = NULL; if (!scsi_device_enclosure(sdev)) { /* not an enclosure, but might be in one */ Loading Loading @@ -456,9 +456,6 @@ static int ses_intf_add(struct class_device *cdev, if (!buf) goto err_free; ses_dev->page1 = buf; ses_dev->page1_len = len; result = ses_recv_diag(sdev, 1, buf, len); if (result) goto recv_failed; Loading @@ -473,6 +470,9 @@ static int ses_intf_add(struct class_device *cdev, type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) components += type_ptr[1]; } ses_dev->page1 = buf; ses_dev->page1_len = len; buf = NULL; result = ses_recv_diag(sdev, 2, hdr_buf, INIT_ALLOC_SIZE); if (result) Loading @@ -489,6 +489,7 @@ static int ses_intf_add(struct class_device *cdev, goto recv_failed; ses_dev->page2 = buf; ses_dev->page2_len = len; buf = NULL; /* The additional information page --- allows us * to match up the devices */ Loading @@ -506,9 +507,10 @@ static int ses_intf_add(struct class_device *cdev, goto recv_failed; ses_dev->page10 = buf; ses_dev->page10_len = len; buf = NULL; no_page10: scomp = kmalloc(sizeof(struct ses_component) * components, GFP_KERNEL); scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL); if (!scomp) goto err_free; Loading @@ -521,10 +523,9 @@ static int ses_intf_add(struct class_device *cdev, edev->scratch = ses_dev; for (i = 0; i < components; i++) edev->component[i].scratch = scomp++; edev->component[i].scratch = scomp + i; /* Page 7 for the descriptors is optional */ buf = NULL; result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE); if (result) goto simple_populate; Loading @@ -532,6 +533,8 @@ static int ses_intf_add(struct class_device *cdev, len = (hdr_buf[2] << 8) + hdr_buf[3] + 4; /* add 1 for trailing '\0' we'll use */ buf = kzalloc(len + 1, GFP_KERNEL); if (!buf) goto simple_populate; result = ses_recv_diag(sdev, 7, buf, len); if (result) { simple_populate: Loading Loading @@ -598,6 +601,7 @@ static int ses_intf_add(struct class_device *cdev, err = -ENODEV; err_free: kfree(buf); kfree(scomp); kfree(ses_dev->page10); kfree(ses_dev->page2); kfree(ses_dev->page1); Loading Loading @@ -630,6 +634,7 @@ static void ses_intf_remove(struct class_device *cdev, ses_dev = edev->scratch; edev->scratch = NULL; kfree(ses_dev->page10); kfree(ses_dev->page1); kfree(ses_dev->page2); kfree(ses_dev); Loading Loading
drivers/scsi/ses.c +14 −9 Original line number Diff line number Diff line Loading @@ -416,7 +416,7 @@ static int ses_intf_add(struct class_device *cdev, int i, j, types, len, components = 0; int err = -ENOMEM; struct enclosure_device *edev; struct ses_component *scomp; struct ses_component *scomp = NULL; if (!scsi_device_enclosure(sdev)) { /* not an enclosure, but might be in one */ Loading Loading @@ -456,9 +456,6 @@ static int ses_intf_add(struct class_device *cdev, if (!buf) goto err_free; ses_dev->page1 = buf; ses_dev->page1_len = len; result = ses_recv_diag(sdev, 1, buf, len); if (result) goto recv_failed; Loading @@ -473,6 +470,9 @@ static int ses_intf_add(struct class_device *cdev, type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) components += type_ptr[1]; } ses_dev->page1 = buf; ses_dev->page1_len = len; buf = NULL; result = ses_recv_diag(sdev, 2, hdr_buf, INIT_ALLOC_SIZE); if (result) Loading @@ -489,6 +489,7 @@ static int ses_intf_add(struct class_device *cdev, goto recv_failed; ses_dev->page2 = buf; ses_dev->page2_len = len; buf = NULL; /* The additional information page --- allows us * to match up the devices */ Loading @@ -506,9 +507,10 @@ static int ses_intf_add(struct class_device *cdev, goto recv_failed; ses_dev->page10 = buf; ses_dev->page10_len = len; buf = NULL; no_page10: scomp = kmalloc(sizeof(struct ses_component) * components, GFP_KERNEL); scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL); if (!scomp) goto err_free; Loading @@ -521,10 +523,9 @@ static int ses_intf_add(struct class_device *cdev, edev->scratch = ses_dev; for (i = 0; i < components; i++) edev->component[i].scratch = scomp++; edev->component[i].scratch = scomp + i; /* Page 7 for the descriptors is optional */ buf = NULL; result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE); if (result) goto simple_populate; Loading @@ -532,6 +533,8 @@ static int ses_intf_add(struct class_device *cdev, len = (hdr_buf[2] << 8) + hdr_buf[3] + 4; /* add 1 for trailing '\0' we'll use */ buf = kzalloc(len + 1, GFP_KERNEL); if (!buf) goto simple_populate; result = ses_recv_diag(sdev, 7, buf, len); if (result) { simple_populate: Loading Loading @@ -598,6 +601,7 @@ static int ses_intf_add(struct class_device *cdev, err = -ENODEV; err_free: kfree(buf); kfree(scomp); kfree(ses_dev->page10); kfree(ses_dev->page2); kfree(ses_dev->page1); Loading Loading @@ -630,6 +634,7 @@ static void ses_intf_remove(struct class_device *cdev, ses_dev = edev->scratch; edev->scratch = NULL; kfree(ses_dev->page10); kfree(ses_dev->page1); kfree(ses_dev->page2); kfree(ses_dev); Loading