svn commit: r253644 - head/sys/dev/ata/chipsets

John Baldwin jhb at freebsd.org
Thu Jul 25 16:35:22 UTC 2013


On Thursday, July 25, 2013 5:12:46 am Alexander Motin wrote:
> Author: mav
> Date: Thu Jul 25 09:12:46 2013
> New Revision: 253644
> URL: http://svnweb.freebsd.org/changeset/base/253644
> 
> Log:
>   Add missing NULL check after malloc(M_NOWAIT).
>   
>   Submitted by:	Dmitry Luhtionov <dmitryluhtionov at gmail.com>
> 
> Modified:
>   head/sys/dev/ata/chipsets/ata-promise.c
> 
> Modified: head/sys/dev/ata/chipsets/ata-promise.c
> ==============================================================================
> --- head/sys/dev/ata/chipsets/ata-promise.c	Thu Jul 25 08:41:22 2013	(r253643)
> +++ head/sys/dev/ata/chipsets/ata-promise.c	Thu Jul 25 09:12:46 2013	(r253644)
> @@ -287,6 +287,10 @@ ata_promise_chipinit(device_t dev)
>  	    /* setup host packet controls */
>  	    hpkt = malloc(sizeof(struct ata_promise_sx4),
>  			  M_ATAPCI, M_NOWAIT | M_ZERO);
> +	    if (hpkt == NULL) {
> +		device_printf(dev, "Cannot allocate HPKT\n");
> +		goto failnfree;
> +	    }
>  	    mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF);
>  	    TAILQ_INIT(&hpkt->queue);
>  	    hpkt->busy = 0;

Why not use M_WAITOK here?

-- 
John Baldwin


More information about the svn-src-all mailing list