Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rpaphp: compiler warning cleanup

This janitorial patch removes the following annoying
compile-time message:

drivers/pci/hotplug/rpaphp_slot.c:57: warning: ignoring return
value of sfs_create_file declared with attribute warn_unused_result

It also fixes a typo, removes some misc crud.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@us.ibm.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Linas Vepstas and committed by
Greg Kroah-Hartman
f1e79092 0c875c28

+23 -24
+23 -24
drivers/pci/hotplug/rpaphp_slot.c
··· 47 47 return retval; 48 48 } 49 49 50 - static struct hotplug_slot_attribute hotplug_slot_attr_location = { 50 + static struct hotplug_slot_attribute php_attr_location = { 51 51 .attr = {.name = "phy_location", .mode = S_IFREG | S_IRUGO}, 52 52 .show = location_read_file, 53 53 }; 54 - 55 - static void rpaphp_sysfs_add_attr_location (struct hotplug_slot *slot) 56 - { 57 - sysfs_create_file(&slot->kobj, &hotplug_slot_attr_location.attr); 58 - } 59 - 60 - static void rpaphp_sysfs_remove_attr_location (struct hotplug_slot *slot) 61 - { 62 - sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_location.attr); 63 - } 64 54 65 55 /* free up the memory used by a slot */ 66 56 static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot) ··· 135 145 list_del(&slot->rpaphp_slot_list); 136 146 137 147 /* remove "phy_location" file */ 138 - rpaphp_sysfs_remove_attr_location(php_slot); 148 + sysfs_remove_file(&php_slot->kobj, &php_attr_location.attr); 139 149 140 150 retval = pci_hp_deregister(php_slot); 141 151 if (retval) ··· 150 160 151 161 int rpaphp_register_slot(struct slot *slot) 152 162 { 163 + struct hotplug_slot *php_slot = slot->hotplug_slot; 153 164 int retval; 154 165 155 166 dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", 156 167 __FUNCTION__, slot->dn->full_name, slot->index, slot->name, 157 168 slot->power_domain, slot->type); 169 + 158 170 /* should not try to register the same slot twice */ 159 - if (is_registered(slot)) { /* should't be here */ 171 + if (is_registered(slot)) { 160 172 err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name); 161 - rpaphp_release_slot(slot->hotplug_slot); 162 - return -EAGAIN; 173 + retval = -EAGAIN; 174 + goto register_fail; 163 175 } 164 - retval = pci_hp_register(slot->hotplug_slot); 176 + 177 + retval = pci_hp_register(php_slot); 165 178 if (retval) { 166 179 err("pci_hp_register failed with error %d\n", retval); 167 - rpaphp_release_slot(slot->hotplug_slot); 168 - return retval; 180 + goto register_fail; 169 181 } 170 - 171 - /* create "phy_locatoin" file */ 172 - rpaphp_sysfs_add_attr_location(slot->hotplug_slot); 182 + 183 + /* create "phy_location" file */ 184 + retval = sysfs_create_file(&php_slot->kobj, &php_attr_location.attr); 185 + if (retval) { 186 + err("sysfs_create_file failed with error %d\n", retval); 187 + goto sysfs_fail; 188 + } 173 189 174 190 /* add slot to our internal list */ 175 - dbg("%s adding slot[%s] to rpaphp_slot_list\n", 176 - __FUNCTION__, slot->name); 177 - 178 191 list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); 179 192 info("Slot [%s](PCI location=%s) registered\n", slot->name, 180 193 slot->location); 181 194 num_slots++; 182 195 return 0; 196 + 197 + sysfs_fail: 198 + pci_hp_deregister(php_slot); 199 + register_fail: 200 + rpaphp_release_slot(php_slot); 201 + return retval; 183 202 } 184 203 185 204 int rpaphp_get_power_status(struct slot *slot, u8 * value)