Skip to contentSkip to conversation

mark scsi_add_host() as __must_check

PATCH Arjan van de Ven 1 participant 1 message Aug 23, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

Hi,

It seems it's a dangerous trap to write the following code:

        scsi_add_host(host, &pdev->dev);
        scsi_scan_host(host);

without checking the return value of scsi_add_host; it seems scsi_add_host() is one of those functions that you reall have to check the return value of, this patch makes it so:

include/scsi/scsi_host.h renamed from include/scsi/scsi_host.h~ +1 -1
@@ -524,7 +524,7 @@
 	container_of(d, struct Scsi_Host, shost_classdev)
 
 extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
-extern int scsi_add_host(struct Scsi_Host *, struct device *);
+extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *);
 extern void scsi_scan_host(struct Scsi_Host *);
 extern void scsi_remove_host(struct Scsi_Host *);
 extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);