.. | .. |
---|
1141 | 1141 | |
---|
1142 | 1142 | sysfs_bin_attr_init(res_attr); |
---|
1143 | 1143 | if (write_combine) { |
---|
1144 | | - pdev->res_attr_wc[num] = res_attr; |
---|
1145 | 1144 | sprintf(res_attr_name, "resource%d_wc", num); |
---|
1146 | 1145 | res_attr->mmap = pci_mmap_resource_wc; |
---|
1147 | 1146 | } else { |
---|
1148 | | - pdev->res_attr[num] = res_attr; |
---|
1149 | 1147 | sprintf(res_attr_name, "resource%d", num); |
---|
1150 | 1148 | if (pci_resource_flags(pdev, num) & IORESOURCE_IO) { |
---|
1151 | 1149 | res_attr->read = pci_read_resource_io; |
---|
.. | .. |
---|
1161 | 1159 | res_attr->size = pci_resource_len(pdev, num); |
---|
1162 | 1160 | res_attr->private = (void *)(unsigned long)num; |
---|
1163 | 1161 | retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr); |
---|
1164 | | - if (retval) |
---|
| 1162 | + if (retval) { |
---|
1165 | 1163 | kfree(res_attr); |
---|
| 1164 | + return retval; |
---|
| 1165 | + } |
---|
1166 | 1166 | |
---|
1167 | | - return retval; |
---|
| 1167 | + if (write_combine) |
---|
| 1168 | + pdev->res_attr_wc[num] = res_attr; |
---|
| 1169 | + else |
---|
| 1170 | + pdev->res_attr[num] = res_attr; |
---|
| 1171 | + |
---|
| 1172 | + return 0; |
---|
1168 | 1173 | } |
---|
1169 | 1174 | |
---|
1170 | 1175 | /** |
---|