Bladeren bron

[PA-RISC] Fix must_check warnings in drivers.c

Panic if we can't register the parisc bus or the root parisc device.
There's no way we can boot without them, so let the user know ASAP.

If we can't register a parisc device, handle the failure gracefully.

Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>
Matthew Wilcox 18 jaren geleden
bovenliggende
commit
1070c9655b
1 gewijzigde bestanden met toevoegingen van 8 en 3 verwijderingen
  1. 8 3
      arch/parisc/kernel/drivers.c

+ 8 - 3
arch/parisc/kernel/drivers.c

@@ -424,7 +424,10 @@ struct parisc_device * create_tree_node(char id, struct device *parent)
 	/* make the generic dma mask a pointer to the parisc one */
 	/* make the generic dma mask a pointer to the parisc one */
 	dev->dev.dma_mask = &dev->dma_mask;
 	dev->dev.dma_mask = &dev->dma_mask;
 	dev->dev.coherent_dma_mask = dev->dma_mask;
 	dev->dev.coherent_dma_mask = dev->dma_mask;
-	device_register(&dev->dev);
+	if (!device_register(&dev->dev)) {
+		kfree(dev);
+		return NULL;
+	}
 
 
 	return dev;
 	return dev;
 }
 }
@@ -850,8 +853,10 @@ static void print_parisc_device(struct parisc_device *dev)
  */
  */
 void init_parisc_bus(void)
 void init_parisc_bus(void)
 {
 {
-	bus_register(&parisc_bus_type);
-	device_register(&root);
+	if (!bus_register(&parisc_bus_type))
+		panic("Could not register PA-RISC bus type\n");
+	if (!device_register(&root))
+		panic("Could not register PA-RISC root device\n");
 	get_device(&root);
 	get_device(&root);
 }
 }