diff options
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r-- | drivers/scsi/sg.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 971783407..04e4a6a28 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -650,6 +650,11 @@ static int sg_common_write(Sg_fd * sfp, Sg_request * srp, } /* SCSI_LOG_TIMEOUT(7, printk("sg_write: allocating device\n")); */ SRpnt = scsi_allocate_request(sdp->device); + if(SRpnt == NULL) { + SCSI_LOG_TIMEOUT(1, printk("sg_write: no mem\n")); + sg_finish_rem_req(srp); + return -ENOMEM; + } /* SCSI_LOG_TIMEOUT(7, printk("sg_write: device allocated\n")); */ srp->my_cmdp = SRpnt; |