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

[SCSI] ncr53c8xx: Call scsi_host_put in release

Since ncr53c8xx_attach() calls scsi_host_put(), make ncr53c8xx_release()
call scsi_host_put() too, for symmetry. Both callers already expect
it to put the host for them, so that works out nicely. While the zalon
driver does 'use' the host pointer afterwards, it only compares it for
equality and doesn't dereference it, so that's safe.

While I'm at it, get rid of pointless checks for NULL, use shost_priv()
and change ncr53c8xx_release to return void.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

Matthew Wilcox and committed by
James Bottomley
dffe807c 6fdea8db

+5 -8
+4 -7
drivers/scsi/ncr53c8xx.c
··· 8528 8528 } 8529 8529 8530 8530 8531 - int ncr53c8xx_release(struct Scsi_Host *host) 8531 + void ncr53c8xx_release(struct Scsi_Host *host) 8532 8532 { 8533 - struct host_data *host_data; 8533 + struct host_data *host_data = shost_priv(host); 8534 8534 #ifdef DEBUG_NCR53C8XX 8535 8535 printk("ncr53c8xx: release\n"); 8536 8536 #endif 8537 - if (!host) 8538 - return 1; 8539 - host_data = (struct host_data *)host->hostdata; 8540 - if (host_data && host_data->ncb) 8537 + if (host_data->ncb) 8541 8538 ncr_detach(host_data->ncb); 8542 - return 1; 8539 + scsi_host_put(host); 8543 8540 } 8544 8541 8545 8542 static void ncr53c8xx_set_period(struct scsi_target *starget, int period)
+1 -1
drivers/scsi/ncr53c8xx.h
··· 1321 1321 }; 1322 1322 1323 1323 extern struct Scsi_Host *ncr_attach(struct scsi_host_template *tpnt, int unit, struct ncr_device *device); 1324 - extern int ncr53c8xx_release(struct Scsi_Host *host); 1324 + extern void ncr53c8xx_release(struct Scsi_Host *host); 1325 1325 irqreturn_t ncr53c8xx_intr(int irq, void *dev_id); 1326 1326 extern int ncr53c8xx_init(void); 1327 1327 extern void ncr53c8xx_exit(void);