Improving r249461 by providing a better way to handle the clang warning.

PR:		kern/177164
Reviewed by:	jhb
Approved by:	sbruno (mentor)
This commit is contained in:
Hiren Panchasara 2013-04-17 21:21:27 +00:00
parent 849c495c94
commit 76fe16bb78

View File

@ -578,7 +578,7 @@ static int ips_copperhead_queue_init(ips_softc_t *sc)
{
int error;
bus_dma_tag_t dmatag;
bus_dmamap_t dmamap = NULL;
bus_dmamap_t dmamap;
if (bus_dma_tag_create( /* parent */ sc->adapter_dmatag,
/* alignemnt */ 1,
/* boundary */ 0,
@ -595,7 +595,7 @@ static int ips_copperhead_queue_init(ips_softc_t *sc)
&dmatag) != 0) {
device_printf(sc->dev, "can't alloc dma tag for statue queue\n");
error = ENOMEM;
goto exit;
return error;
}
if(bus_dmamem_alloc(dmatag, (void *)&(sc->copper_queue),
BUS_DMA_NOWAIT, &dmamap)){
@ -623,7 +623,8 @@ static int ips_copperhead_queue_init(ips_softc_t *sc)
return 0;
exit:
bus_dmamem_free(dmatag, sc->copper_queue, dmamap);
if (sc->copper_queue != NULL)
bus_dmamem_free(dmatag, sc->copper_queue, dmamap);
bus_dma_tag_destroy(dmatag);
return error;
}