staging: Remove unnecessary OOM messages

alloc failures already get standardized OOM
messages and a dump_stack.

For the affected mallocs around these OOM messages:

Converted kzallocs with multiplies to kcalloc.
Converted kmallocs with multiplies to kmalloc_array.
Converted a kmalloc/strlen/strncpy to kstrdup.
Moved a spin_lock below a removed OOM message and
removed a now unnecessary spin_unlock.
Neatened alignment and whitespace.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Joe Perches 2013-02-11 09:41:29 -08:00 committed by Greg Kroah-Hartman
parent ad463ac427
commit 78110bb8dc
53 changed files with 143 additions and 376 deletions

View File

@ -164,11 +164,8 @@ static void enable_oled(struct asus_oled_dev *odev, uint8_t enabl)
struct asus_oled_packet *packet; struct asus_oled_packet *packet;
packet = kzalloc(sizeof(struct asus_oled_packet), GFP_KERNEL); packet = kzalloc(sizeof(struct asus_oled_packet), GFP_KERNEL);
if (!packet)
if (!packet) {
dev_err(&odev->udev->dev, "out of memory\n");
return; return;
}
setup_packet_header(packet, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00); setup_packet_header(packet, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00);
@ -323,11 +320,8 @@ static void send_data(struct asus_oled_dev *odev)
struct asus_oled_packet *packet; struct asus_oled_packet *packet;
packet = kzalloc(sizeof(struct asus_oled_packet), GFP_KERNEL); packet = kzalloc(sizeof(struct asus_oled_packet), GFP_KERNEL);
if (!packet)
if (!packet) {
dev_err(&odev->udev->dev, "out of memory\n");
return; return;
}
if (odev->pack_mode == PACK_MODE_G1) { if (odev->pack_mode == PACK_MODE_G1) {
/* When sending roll-mode data the display updated only /* When sending roll-mode data the display updated only
@ -665,11 +659,8 @@ static int asus_oled_probe(struct usb_interface *interface,
} }
odev = kzalloc(sizeof(struct asus_oled_dev), GFP_KERNEL); odev = kzalloc(sizeof(struct asus_oled_dev), GFP_KERNEL);
if (odev == NULL)
if (odev == NULL) {
dev_err(&interface->dev, "Out of memory\n");
return -ENOMEM; return -ENOMEM;
}
odev->udev = usb_get_dev(udev); odev->udev = usb_get_dev(udev);
odev->pic_mode = ASUS_OLED_STATIC; odev->pic_mode = ASUS_OLED_STATIC;

View File

@ -190,9 +190,9 @@ static int usbbcm_device_probe(struct usb_interface *intf, const struct usb_devi
} }
/* Allocate interface adapter structure */ /* Allocate interface adapter structure */
psIntfAdapter = kzalloc(sizeof(struct bcm_interface_adapter), GFP_KERNEL); psIntfAdapter = kzalloc(sizeof(struct bcm_interface_adapter),
GFP_KERNEL);
if (psIntfAdapter == NULL) { if (psIntfAdapter == NULL) {
dev_err(&udev->dev, DRV_NAME ": no memory for Interface adapter\n");
AdapterFree(psAdapter); AdapterFree(psAdapter);
return -ENOMEM; return -ENOMEM;
} }
@ -564,12 +564,9 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter)
psIntfAdapter->sIntrIn.int_in_interval = endpoint->bInterval; psIntfAdapter->sIntrIn.int_in_interval = endpoint->bInterval;
psIntfAdapter->sIntrIn.int_in_buffer = psIntfAdapter->sIntrIn.int_in_buffer =
kmalloc(buffer_size, GFP_KERNEL); kmalloc(buffer_size, GFP_KERNEL);
if (!psIntfAdapter->sIntrIn.int_in_buffer) { if (!psIntfAdapter->sIntrIn.int_in_buffer)
dev_err(&psIntfAdapter->udev->dev,
"could not allocate interrupt_in_buffer\n");
return -EINVAL; return -EINVAL;
} }
}
if (!psIntfAdapter->sIntrOut.int_out_endpointAddr && bcm_usb_endpoint_is_int_out(endpoint)) { if (!psIntfAdapter->sIntrOut.int_out_endpointAddr && bcm_usb_endpoint_is_int_out(endpoint)) {
if (!psIntfAdapter->sBulkOut.bulk_out_endpointAddr && if (!psIntfAdapter->sBulkOut.bulk_out_endpointAddr &&
@ -587,14 +584,11 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter)
psIntfAdapter->sIntrOut.int_out_endpointAddr = endpoint->bEndpointAddress; psIntfAdapter->sIntrOut.int_out_endpointAddr = endpoint->bEndpointAddress;
psIntfAdapter->sIntrOut.int_out_interval = endpoint->bInterval; psIntfAdapter->sIntrOut.int_out_interval = endpoint->bInterval;
psIntfAdapter->sIntrOut.int_out_buffer = kmalloc(buffer_size, GFP_KERNEL); psIntfAdapter->sIntrOut.int_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!psIntfAdapter->sIntrOut.int_out_buffer) { if (!psIntfAdapter->sIntrOut.int_out_buffer)
dev_err(&psIntfAdapter->udev->dev,
"could not allocate interrupt_out_buffer\n");
return -EINVAL; return -EINVAL;
} }
} }
} }
}
usb_set_intfdata(psIntfAdapter->interface, psIntfAdapter); usb_set_intfdata(psIntfAdapter->interface, psIntfAdapter);

View File

@ -1391,10 +1391,8 @@ static int ced_probe(struct usb_interface *interface,
// allocate memory for our device extension and initialize it // allocate memory for our device extension and initialize it
pdx = kzalloc(sizeof(*pdx), GFP_KERNEL); pdx = kzalloc(sizeof(*pdx), GFP_KERNEL);
if (!pdx) { if (!pdx)
dev_err(&interface->dev, "Out of memory\n");
goto error; goto error;
}
for (i = 0; i < MAX_TRANSAREAS; ++i) // Initialise the wait queues for (i = 0; i < MAX_TRANSAREAS; ++i) // Initialise the wait queues
{ {

View File

@ -203,10 +203,9 @@ static int __comedi_device_postconfig_async(struct comedi_device *dev,
} }
async = kzalloc(sizeof(*async), GFP_KERNEL); async = kzalloc(sizeof(*async), GFP_KERNEL);
if (!async) { if (!async)
dev_warn(dev->class_dev, "failed to allocate async struct\n");
return -ENOMEM; return -ENOMEM;
}
init_waitqueue_head(&async->wait_head); init_waitqueue_head(&async->wait_head);
async->subdevice = s; async->subdevice = s;
s->async = async; s->async = async;

View File

@ -1105,10 +1105,9 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
struct dio200_subdev_intr *subpriv; struct dio200_subdev_intr *subpriv;
subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL); subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL);
if (!subpriv) { if (!subpriv)
dev_err(dev->class_dev, "error! out of memory!\n");
return -ENOMEM; return -ENOMEM;
}
subpriv->ofs = offset; subpriv->ofs = offset;
subpriv->valid_isns = valid_isns; subpriv->valid_isns = valid_isns;
spin_lock_init(&subpriv->spinlock); spin_lock_init(&subpriv->spinlock);
@ -1444,10 +1443,8 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned int chan; unsigned int chan;
subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL); subpriv = kzalloc(sizeof(*subpriv), GFP_KERNEL);
if (!subpriv) { if (!subpriv)
dev_err(dev->class_dev, "error! out of memory!\n");
return -ENOMEM; return -ENOMEM;
}
s->private = subpriv; s->private = subpriv;
s->type = COMEDI_SUBD_COUNTER; s->type = COMEDI_SUBD_COUNTER;

View File

@ -245,10 +245,9 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it)
return 0; return 0;
} }
bdev = kmalloc(sizeof(*bdev), GFP_KERNEL); bdev = kmalloc(sizeof(*bdev), GFP_KERNEL);
if (!bdev) { if (!bdev)
dev_err(dev->class_dev, "Out of memory\n");
return 0; return 0;
}
bdev->dev = d; bdev->dev = d;
bdev->minor = minor; bdev->minor = minor;
bdev->subdev = sdev; bdev->subdev = sdev;

View File

@ -702,10 +702,9 @@ static int dt9812_probe(struct usb_interface *interface,
/* allocate memory for our device state and initialize it */ /* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL)
dev_err(&interface->dev, "Out of memory\n");
goto error; goto error;
}
kref_init(&dev->kref); kref_init(&dev->kref);
dev->udev = usb_get_dev(interface_to_usbdev(interface)); dev->udev = usb_get_dev(interface_to_usbdev(interface));

View File

@ -570,13 +570,11 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
return -EINVAL; return -EINVAL;
} else if (dma_chan) { } else if (dma_chan) {
/* allocate dma buffer */ /* allocate dma buffer */
devpriv->dma_buffer = devpriv->dma_buffer = kmalloc(dma_buffer_size,
kmalloc(dma_buffer_size, GFP_KERNEL | GFP_DMA); GFP_KERNEL | GFP_DMA);
if (devpriv->dma_buffer == NULL) { if (devpriv->dma_buffer == NULL)
dev_err(dev->class_dev,
"failed to allocate dma buffer\n");
return -ENOMEM; return -ENOMEM;
}
if (request_dma(dma_chan, DRV_NAME)) { if (request_dma(dma_chan, DRV_NAME)) {
dev_err(dev->class_dev, dev_err(dev->class_dev,
"failed to allocate dma channel %u\n", "failed to allocate dma channel %u\n",

View File

@ -838,14 +838,11 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
chans_left = CHANS_PER_ASIC * board->num_asics; chans_left = CHANS_PER_ASIC * board->num_asics;
n_subdevs = CALC_N_SUBDEVS(chans_left); n_subdevs = CALC_N_SUBDEVS(chans_left);
devpriv->sprivs = devpriv->sprivs = kcalloc(n_subdevs,
kcalloc(n_subdevs, sizeof(struct pcmuio_subdev_private), sizeof(struct pcmuio_subdev_private),
GFP_KERNEL); GFP_KERNEL);
if (!devpriv->sprivs) { if (!devpriv->sprivs)
dev_warn(dev->class_dev,
"cannot allocate subdevice private data structures\n");
return -ENOMEM; return -ENOMEM;
}
ret = comedi_alloc_subdevices(dev, n_subdevs); ret = comedi_alloc_subdevices(dev, n_subdevs);
if (ret) if (ret)

View File

@ -380,12 +380,8 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev,
} }
usp = kzalloc(sizeof(*usp), GFP_KERNEL); usp = kzalloc(sizeof(*usp), GFP_KERNEL);
if (usp == NULL)
if (usp == NULL) {
dev_err(subdev->class_dev,
"comedi%d: error! --> out of memory!\n", minor);
return -1; return -1;
}
usp->usp_iobase = subdev_iobase; usp->usp_iobase = subdev_iobase;
dev_info(subdev->class_dev, "comedi%d: |", minor); dev_info(subdev->class_dev, "comedi%d: |", minor);

View File

@ -2445,8 +2445,6 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
/* create space for the commands of the DA converter */ /* create space for the commands of the DA converter */
usbduxsub[index].dac_commands = kzalloc(NUMOUTCHANNELS, GFP_KERNEL); usbduxsub[index].dac_commands = kzalloc(NUMOUTCHANNELS, GFP_KERNEL);
if (!usbduxsub[index].dac_commands) { if (!usbduxsub[index].dac_commands) {
dev_err(dev, "comedi_: usbdux: "
"error alloc space for dac commands\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2454,8 +2452,6 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
/* create space for the commands going to the usb device */ /* create space for the commands going to the usb device */
usbduxsub[index].dux_commands = kzalloc(SIZEOFDUXBUFFER, GFP_KERNEL); usbduxsub[index].dux_commands = kzalloc(SIZEOFDUXBUFFER, GFP_KERNEL);
if (!usbduxsub[index].dux_commands) { if (!usbduxsub[index].dux_commands) {
dev_err(dev, "comedi_: usbdux: "
"error alloc space for dux commands\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2463,8 +2459,6 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
/* create space for the in buffer and set it to zero */ /* create space for the in buffer and set it to zero */
usbduxsub[index].inBuffer = kzalloc(SIZEINBUF, GFP_KERNEL); usbduxsub[index].inBuffer = kzalloc(SIZEINBUF, GFP_KERNEL);
if (!(usbduxsub[index].inBuffer)) { if (!(usbduxsub[index].inBuffer)) {
dev_err(dev, "comedi_: usbdux: "
"could not alloc space for inBuffer\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2472,8 +2466,6 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
/* create space of the instruction buffer */ /* create space of the instruction buffer */
usbduxsub[index].insnBuffer = kzalloc(SIZEINSNBUF, GFP_KERNEL); usbduxsub[index].insnBuffer = kzalloc(SIZEINSNBUF, GFP_KERNEL);
if (!(usbduxsub[index].insnBuffer)) { if (!(usbduxsub[index].insnBuffer)) {
dev_err(dev, "comedi_: usbdux: "
"could not alloc space for insnBuffer\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2481,8 +2473,6 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
/* create space for the outbuffer */ /* create space for the outbuffer */
usbduxsub[index].outBuffer = kzalloc(SIZEOUTBUF, GFP_KERNEL); usbduxsub[index].outBuffer = kzalloc(SIZEOUTBUF, GFP_KERNEL);
if (!(usbduxsub[index].outBuffer)) { if (!(usbduxsub[index].outBuffer)) {
dev_err(dev, "comedi_: usbdux: "
"could not alloc space for outBuffer\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2504,10 +2494,9 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSFULL; usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSFULL;
usbduxsub[index].urbIn = usbduxsub[index].urbIn =
kzalloc(sizeof(struct urb *) * usbduxsub[index].numOfInBuffers, kcalloc(usbduxsub[index].numOfInBuffers, sizeof(struct urb *),
GFP_KERNEL); GFP_KERNEL);
if (!(usbduxsub[index].urbIn)) { if (!(usbduxsub[index].urbIn)) {
dev_err(dev, "comedi_: usbdux: Could not alloc. urbIn array\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2532,8 +2521,6 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].urbIn[i]->transfer_buffer = usbduxsub[index].urbIn[i]->transfer_buffer =
kzalloc(SIZEINBUF, GFP_KERNEL); kzalloc(SIZEINBUF, GFP_KERNEL);
if (!(usbduxsub[index].urbIn[i]->transfer_buffer)) { if (!(usbduxsub[index].urbIn[i]->transfer_buffer)) {
dev_err(dev, "comedi_: usbdux%d: "
"could not alloc. transb.\n", index);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2552,11 +2539,9 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSFULL; usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSFULL;
usbduxsub[index].urbOut = usbduxsub[index].urbOut =
kzalloc(sizeof(struct urb *) * usbduxsub[index].numOfOutBuffers, kcalloc(usbduxsub[index].numOfOutBuffers, sizeof(struct urb *),
GFP_KERNEL); GFP_KERNEL);
if (!(usbduxsub[index].urbOut)) { if (!(usbduxsub[index].urbOut)) {
dev_err(dev, "comedi_: usbdux: "
"Could not alloc. urbOut array\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2581,8 +2566,6 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].urbOut[i]->transfer_buffer = usbduxsub[index].urbOut[i]->transfer_buffer =
kzalloc(SIZEOUTBUF, GFP_KERNEL); kzalloc(SIZEOUTBUF, GFP_KERNEL);
if (!(usbduxsub[index].urbOut[i]->transfer_buffer)) { if (!(usbduxsub[index].urbOut[i]->transfer_buffer)) {
dev_err(dev, "comedi_: usbdux%d: "
"could not alloc. transb.\n", index);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2617,8 +2600,6 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].urbPwm->transfer_buffer = usbduxsub[index].urbPwm->transfer_buffer =
kzalloc(usbduxsub[index].sizePwmBuf, GFP_KERNEL); kzalloc(usbduxsub[index].sizePwmBuf, GFP_KERNEL);
if (!(usbduxsub[index].urbPwm->transfer_buffer)) { if (!(usbduxsub[index].urbPwm->transfer_buffer)) {
dev_err(dev, "comedi_: usbdux%d: "
"could not alloc. transb. for pwm\n", index);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;

View File

@ -1556,8 +1556,6 @@ static int usbduxfast_usb_probe(struct usb_interface *uinterf,
usbduxfastsub[index].dux_commands = kmalloc(SIZEOFDUXBUFFER, usbduxfastsub[index].dux_commands = kmalloc(SIZEOFDUXBUFFER,
GFP_KERNEL); GFP_KERNEL);
if (!usbduxfastsub[index].dux_commands) { if (!usbduxfastsub[index].dux_commands) {
dev_err(&uinterf->dev,
"error alloc space for dac commands\n");
tidy_up(&(usbduxfastsub[index])); tidy_up(&(usbduxfastsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -1565,8 +1563,6 @@ static int usbduxfast_usb_probe(struct usb_interface *uinterf,
/* create space of the instruction buffer */ /* create space of the instruction buffer */
usbduxfastsub[index].insnBuffer = kmalloc(SIZEINSNBUF, GFP_KERNEL); usbduxfastsub[index].insnBuffer = kmalloc(SIZEINSNBUF, GFP_KERNEL);
if (!usbduxfastsub[index].insnBuffer) { if (!usbduxfastsub[index].insnBuffer) {
dev_err(&uinterf->dev,
"could not alloc space for insnBuffer\n");
tidy_up(&(usbduxfastsub[index])); tidy_up(&(usbduxfastsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -1592,8 +1588,6 @@ static int usbduxfast_usb_probe(struct usb_interface *uinterf,
} }
usbduxfastsub[index].transfer_buffer = kmalloc(SIZEINBUF, GFP_KERNEL); usbduxfastsub[index].transfer_buffer = kmalloc(SIZEINBUF, GFP_KERNEL);
if (!usbduxfastsub[index].transfer_buffer) { if (!usbduxfastsub[index].transfer_buffer) {
dev_err(&uinterf->dev,
"usbduxfast%d: could not alloc. transb.\n", index);
tidy_up(&(usbduxfastsub[index])); tidy_up(&(usbduxfastsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;

View File

@ -2431,8 +2431,6 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
/* create space for the commands of the DA converter */ /* create space for the commands of the DA converter */
usbduxsub[index].dac_commands = kzalloc(NUMOUTCHANNELS, GFP_KERNEL); usbduxsub[index].dac_commands = kzalloc(NUMOUTCHANNELS, GFP_KERNEL);
if (!usbduxsub[index].dac_commands) { if (!usbduxsub[index].dac_commands) {
dev_err(dev, "comedi_: usbduxsigma: "
"error alloc space for dac commands\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2440,8 +2438,6 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
/* create space for the commands going to the usb device */ /* create space for the commands going to the usb device */
usbduxsub[index].dux_commands = kzalloc(SIZEOFDUXBUFFER, GFP_KERNEL); usbduxsub[index].dux_commands = kzalloc(SIZEOFDUXBUFFER, GFP_KERNEL);
if (!usbduxsub[index].dux_commands) { if (!usbduxsub[index].dux_commands) {
dev_err(dev, "comedi_: usbduxsigma: "
"error alloc space for dux commands\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2449,8 +2445,6 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
/* create space for the in buffer and set it to zero */ /* create space for the in buffer and set it to zero */
usbduxsub[index].inBuffer = kzalloc(SIZEINBUF, GFP_KERNEL); usbduxsub[index].inBuffer = kzalloc(SIZEINBUF, GFP_KERNEL);
if (!(usbduxsub[index].inBuffer)) { if (!(usbduxsub[index].inBuffer)) {
dev_err(dev, "comedi_: usbduxsigma: "
"could not alloc space for inBuffer\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2458,8 +2452,6 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
/* create space of the instruction buffer */ /* create space of the instruction buffer */
usbduxsub[index].insnBuffer = kzalloc(SIZEINSNBUF, GFP_KERNEL); usbduxsub[index].insnBuffer = kzalloc(SIZEINSNBUF, GFP_KERNEL);
if (!(usbduxsub[index].insnBuffer)) { if (!(usbduxsub[index].insnBuffer)) {
dev_err(dev, "comedi_: usbduxsigma: "
"could not alloc space for insnBuffer\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2467,8 +2459,6 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
/* create space for the outbuffer */ /* create space for the outbuffer */
usbduxsub[index].outBuffer = kzalloc(SIZEOUTBUF, GFP_KERNEL); usbduxsub[index].outBuffer = kzalloc(SIZEOUTBUF, GFP_KERNEL);
if (!(usbduxsub[index].outBuffer)) { if (!(usbduxsub[index].outBuffer)) {
dev_err(dev, "comedi_: usbduxsigma: "
"could not alloc space for outBuffer\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2489,12 +2479,10 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
else else
usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSFULL; usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSFULL;
usbduxsub[index].urbIn = usbduxsub[index].urbIn = kcalloc(usbduxsub[index].numOfInBuffers,
kzalloc(sizeof(struct urb *) * usbduxsub[index].numOfInBuffers, sizeof(struct urb *),
GFP_KERNEL); GFP_KERNEL);
if (!(usbduxsub[index].urbIn)) { if (!(usbduxsub[index].urbIn)) {
dev_err(dev, "comedi_: usbduxsigma: "
"Could not alloc. urbIn array\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2519,8 +2507,6 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].urbIn[i]->transfer_buffer = usbduxsub[index].urbIn[i]->transfer_buffer =
kzalloc(SIZEINBUF, GFP_KERNEL); kzalloc(SIZEINBUF, GFP_KERNEL);
if (!(usbduxsub[index].urbIn[i]->transfer_buffer)) { if (!(usbduxsub[index].urbIn[i]->transfer_buffer)) {
dev_err(dev, "comedi_: usbduxsigma%d: "
"could not alloc. transb.\n", index);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2539,12 +2525,9 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
else else
usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSFULL; usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSFULL;
usbduxsub[index].urbOut = usbduxsub[index].urbOut = kcalloc(usbduxsub[index].numOfOutBuffers,
kzalloc(sizeof(struct urb *) * usbduxsub[index].numOfOutBuffers, sizeof(struct urb *), GFP_KERNEL);
GFP_KERNEL);
if (!(usbduxsub[index].urbOut)) { if (!(usbduxsub[index].urbOut)) {
dev_err(dev, "comedi_: usbduxsigma: "
"Could not alloc. urbOut array\n");
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2569,8 +2552,6 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].urbOut[i]->transfer_buffer = usbduxsub[index].urbOut[i]->transfer_buffer =
kzalloc(SIZEOUTBUF, GFP_KERNEL); kzalloc(SIZEOUTBUF, GFP_KERNEL);
if (!(usbduxsub[index].urbOut[i]->transfer_buffer)) { if (!(usbduxsub[index].urbOut[i]->transfer_buffer)) {
dev_err(dev, "comedi_: usbduxsigma%d: "
"could not alloc. transb.\n", index);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
@ -2606,8 +2587,6 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].urbPwm->transfer_buffer = usbduxsub[index].urbPwm->transfer_buffer =
kzalloc(usbduxsub[index].sizePwmBuf, GFP_KERNEL); kzalloc(usbduxsub[index].sizePwmBuf, GFP_KERNEL);
if (!(usbduxsub[index].urbPwm->transfer_buffer)) { if (!(usbduxsub[index].urbPwm->transfer_buffer)) {
dev_err(dev, "comedi_: usbduxsigma%d: "
"could not alloc. transb. for pwm\n", index);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;

View File

@ -421,11 +421,8 @@ static int cp_tm1217_probe(struct i2c_client *client,
pdata = client->dev.platform_data; pdata = client->dev.platform_data;
ts = kzalloc(sizeof(struct cp_tm1217_device), GFP_KERNEL); ts = kzalloc(sizeof(struct cp_tm1217_device), GFP_KERNEL);
if (!ts) { if (!ts)
dev_err(&client->dev,
"cp_tm1217: Private Device Struct alloc failed\n");
return -ENOMEM; return -ENOMEM;
}
ts->client = client; ts->client = client;
ts->dev = &client->dev; ts->dev = &client->dev;

View File

@ -2462,11 +2462,8 @@ static int et131x_init_recv(struct et131x_adapter *adapter)
/* Setup each RFD */ /* Setup each RFD */
for (rfdct = 0; rfdct < rx_ring->num_rfd; rfdct++) { for (rfdct = 0; rfdct < rx_ring->num_rfd; rfdct++) {
rfd = kzalloc(sizeof(struct rfd), GFP_ATOMIC | GFP_DMA); rfd = kzalloc(sizeof(struct rfd), GFP_ATOMIC | GFP_DMA);
if (!rfd)
if (!rfd) {
dev_err(&adapter->pdev->dev, "Couldn't alloc RFD\n");
return -ENOMEM; return -ENOMEM;
}
rfd->skb = NULL; rfd->skb = NULL;
@ -2814,12 +2811,10 @@ static int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter)
struct tx_ring *tx_ring = &adapter->tx_ring; struct tx_ring *tx_ring = &adapter->tx_ring;
/* Allocate memory for the TCB's (Transmit Control Block) */ /* Allocate memory for the TCB's (Transmit Control Block) */
adapter->tx_ring.tcb_ring = adapter->tx_ring.tcb_ring = kcalloc(NUM_TCB, sizeof(struct tcb),
kcalloc(NUM_TCB, sizeof(struct tcb), GFP_ATOMIC | GFP_DMA); GFP_ATOMIC | GFP_DMA);
if (!adapter->tx_ring.tcb_ring) { if (!adapter->tx_ring.tcb_ring)
dev_err(&adapter->pdev->dev, "Cannot alloc memory for TCBs\n");
return -ENOMEM; return -ENOMEM;
}
desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX); desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX);
tx_ring->tx_desc_ring = tx_ring->tx_desc_ring =
@ -4895,11 +4890,10 @@ static int et131x_pci_setup(struct pci_dev *pdev,
adapter->mii_bus->read = et131x_mdio_read; adapter->mii_bus->read = et131x_mdio_read;
adapter->mii_bus->write = et131x_mdio_write; adapter->mii_bus->write = et131x_mdio_write;
adapter->mii_bus->reset = et131x_mdio_reset; adapter->mii_bus->reset = et131x_mdio_reset;
adapter->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); adapter->mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int),
if (!adapter->mii_bus->irq) { GFP_KERNEL);
dev_err(&pdev->dev, "mii_bus irq allocation failed\n"); if (!adapter->mii_bus->irq)
goto err_mdio_free; goto err_mdio_free;
}
for (ii = 0; ii < PHY_MAX_ADDR; ii++) for (ii = 0; ii < PHY_MAX_ADDR; ii++)
adapter->mii_bus->irq[ii] = PHY_POLL; adapter->mii_bus->irq[ii] = PHY_POLL;

View File

@ -678,10 +678,9 @@ static int usb_alphatrack_probe(struct usb_interface *intf,
/* allocate memory for our device state and initialize it */ /* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL)
dev_err(&intf->dev, "Out of memory\n");
goto exit; goto exit;
}
mutex_init(&dev->mtx); mutex_init(&dev->mtx);
dev->intf = intf; dev->intf = intf;
init_waitqueue_head(&dev->read_wait); init_waitqueue_head(&dev->read_wait);
@ -721,28 +720,21 @@ static int usb_alphatrack_probe(struct usb_interface *intf,
/* FIXME - there are more usb_alloc routines for dma correctness. /* FIXME - there are more usb_alloc routines for dma correctness.
Needed? */ Needed? */
dev->ring_buffer = dev->ring_buffer = kmalloc_array(true_size,
kmalloc((true_size * sizeof(struct alphatrack_icmd)), GFP_KERNEL); sizeof(struct alphatrack_icmd),
GFP_KERNEL);
if (!dev->ring_buffer) { if (!dev->ring_buffer)
dev_err(&intf->dev,
"Couldn't allocate input ring_buffer of size %d\n",
true_size);
goto error; goto error;
}
dev->interrupt_in_buffer = dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size,
kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); GFP_KERNEL);
if (!dev->interrupt_in_buffer)
if (!dev->interrupt_in_buffer) {
dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n");
goto error; goto error;
}
dev->oldi_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); dev->oldi_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL);
if (!dev->oldi_buffer) { if (!dev->oldi_buffer)
dev_err(&intf->dev, "Couldn't allocate old buffer\n");
goto error; goto error;
}
dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_in_urb) { if (!dev->interrupt_in_urb) {
dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n"); dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n");
@ -764,20 +756,17 @@ static int usb_alphatrack_probe(struct usb_interface *intf,
true_size = min(write_buffer_size, WRITE_BUFFER_SIZE); true_size = min(write_buffer_size, WRITE_BUFFER_SIZE);
dev->interrupt_out_buffer = dev->interrupt_out_buffer =
kmalloc(true_size * dev->interrupt_out_endpoint_size, GFP_KERNEL); kmalloc_array(true_size,
dev->interrupt_out_endpoint_size,
if (!dev->interrupt_out_buffer) { GFP_KERNEL);
dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n"); if (!dev->interrupt_out_buffer)
goto error; goto error;
}
dev->write_buffer = dev->write_buffer = kmalloc_array(true_size,
kmalloc(true_size * sizeof(struct alphatrack_ocmd), GFP_KERNEL); sizeof(struct alphatrack_ocmd),
GFP_KERNEL);
if (!dev->write_buffer) { if (!dev->write_buffer)
dev_err(&intf->dev, "Couldn't allocate write_buffer\n");
goto error; goto error;
}
dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_out_urb) { if (!dev->interrupt_out_urb) {

View File

@ -803,10 +803,9 @@ static int usb_tranzport_probe(struct usb_interface *intf,
/* allocate memory for our device state and initialize it */ /* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL)
dev_err(&intf->dev, "Out of memory\n");
goto exit; goto exit;
}
mutex_init(&dev->mtx); mutex_init(&dev->mtx);
dev->intf = intf; dev->intf = intf;
init_waitqueue_head(&dev->read_wait); init_waitqueue_head(&dev->read_wait);
@ -848,18 +847,14 @@ static int usb_tranzport_probe(struct usb_interface *intf,
dev->ring_buffer = dev->ring_buffer =
kmalloc((true_size * sizeof(struct tranzport_cmd)) + 8, GFP_KERNEL); kmalloc((true_size * sizeof(struct tranzport_cmd)) + 8, GFP_KERNEL);
if (!dev->ring_buffer)
if (!dev->ring_buffer) {
dev_err(&intf->dev,
"Couldn't allocate ring_buffer size %d\n", true_size);
goto error; goto error;
}
dev->interrupt_in_buffer = dev->interrupt_in_buffer =
kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL);
if (!dev->interrupt_in_buffer) { if (!dev->interrupt_in_buffer)
dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n");
goto error; goto error;
}
dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_in_urb) { if (!dev->interrupt_in_urb) {
dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n"); dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n");
@ -875,12 +870,11 @@ static int usb_tranzport_probe(struct usb_interface *intf,
"Interrupt out endpoint size is not 8!)\n"); "Interrupt out endpoint size is not 8!)\n");
dev->interrupt_out_buffer = dev->interrupt_out_buffer =
kmalloc(write_buffer_size * dev->interrupt_out_endpoint_size, kmalloc_array(write_buffer_size,
GFP_KERNEL); dev->interrupt_out_endpoint_size, GFP_KERNEL);
if (!dev->interrupt_out_buffer) { if (!dev->interrupt_out_buffer)
dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n");
goto error; goto error;
}
dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_out_urb) { if (!dev->interrupt_out_urb) {
dev_err(&intf->dev, "Couldn't allocate interrupt_out_urb\n"); dev_err(&intf->dev, "Couldn't allocate interrupt_out_urb\n");

View File

@ -68,11 +68,8 @@ static int ft1000_probe(struct usb_interface *interface,
const struct firmware *dsp_fw; const struct firmware *dsp_fw;
ft1000dev = kzalloc(sizeof(struct ft1000_usb), GFP_KERNEL); ft1000dev = kzalloc(sizeof(struct ft1000_usb), GFP_KERNEL);
if (!ft1000dev)
if (!ft1000dev) {
pr_err("out of memory allocating device structure\n");
return -ENOMEM; return -ENOMEM;
}
dev = interface_to_usbdev(interface); dev = interface_to_usbdev(interface);
DEBUG("ft1000_probe: usb device descriptor info:\n"); DEBUG("ft1000_probe: usb device descriptor info:\n");

View File

@ -156,10 +156,8 @@ static int init_sdio(struct sdiowm_dev *sdev)
spin_lock_init(&tx->lock); spin_lock_init(&tx->lock);
tx->sdu_buf = kmalloc(SDU_TX_BUF_SIZE, GFP_KERNEL); tx->sdu_buf = kmalloc(SDU_TX_BUF_SIZE, GFP_KERNEL);
if (tx->sdu_buf == NULL) { if (tx->sdu_buf == NULL)
dev_err(&sdev->func->dev, "Failed to allocate SDU tx buffer.\n");
goto fail; goto fail;
}
for (i = 0; i < MAX_NR_SDU_BUF; i++) { for (i = 0; i < MAX_NR_SDU_BUF; i++) {
t = alloc_tx_struct(tx); t = alloc_tx_struct(tx);
@ -185,10 +183,8 @@ static int init_sdio(struct sdiowm_dev *sdev)
} }
rx->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL); rx->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL);
if (rx->rx_buf == NULL) { if (rx->rx_buf == NULL)
dev_err(&sdev->func->dev, "Failed to allocate rx buffer.\n");
goto fail; goto fail;
}
return 0; return 0;

View File

@ -72,10 +72,8 @@ static int download_image(struct sdio_func *func, const char *img_name)
} }
buf = kmalloc(DOWNLOAD_SIZE + TYPE_A_HEADER_SIZE, GFP_KERNEL); buf = kmalloc(DOWNLOAD_SIZE + TYPE_A_HEADER_SIZE, GFP_KERNEL);
if (buf == NULL) { if (buf == NULL)
dev_err(&func->dev, "Error: kmalloc\n");
return -ENOMEM; return -ENOMEM;
}
img_len = firm->size; img_len = firm->size;
@ -141,11 +139,8 @@ int sdio_boot(struct sdio_func *func)
const char *rfs_name = FW_DIR FW_RFS; const char *rfs_name = FW_DIR FW_RFS;
tx_buf = kmalloc(YMEM0_SIZE, GFP_KERNEL); tx_buf = kmalloc(YMEM0_SIZE, GFP_KERNEL);
if (tx_buf == NULL) { if (tx_buf == NULL)
dev_err(&func->dev, "Error: kmalloc: %s %d\n",
__func__, __LINE__);
return -ENOMEM; return -ENOMEM;
}
ret = download_image(func, krn_name); ret = download_image(func, krn_name);
if (ret) if (ret)

View File

@ -158,10 +158,8 @@ int usb_boot(struct usb_device *usbdev, u16 pid)
} }
tx_buf = kmalloc(DOWNLOAD_SIZE, GFP_KERNEL); tx_buf = kmalloc(DOWNLOAD_SIZE, GFP_KERNEL);
if (tx_buf == NULL) { if (tx_buf == NULL)
dev_err(&usbdev->dev, "Error: kmalloc\n");
return -ENOMEM; return -ENOMEM;
}
if (firm->size < sizeof(hdr)) { if (firm->size < sizeof(hdr)) {
dev_err(&usbdev->dev, "Cannot read the image info.\n"); dev_err(&usbdev->dev, "Cannot read the image info.\n");
@ -301,10 +299,8 @@ static int em_download_image(struct usb_device *usbdev, const char *img_name,
} }
buf = kmalloc(DOWNLOAD_CHUCK + pad_size, GFP_KERNEL); buf = kmalloc(DOWNLOAD_CHUCK + pad_size, GFP_KERNEL);
if (buf == NULL) { if (buf == NULL)
dev_err(&usbdev->dev, "Error: kmalloc\n");
return -ENOMEM; return -ENOMEM;
}
strcpy(buf+pad_size, type_string); strcpy(buf+pad_size, type_string);
ret = gdm_wibro_send(usbdev, buf, strlen(type_string)+pad_size); ret = gdm_wibro_send(usbdev, buf, strlen(type_string)+pad_size);

View File

@ -140,11 +140,8 @@ static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p)
char *data; char *data;
data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
if (data == NULL) { if (data == NULL)
dev_err(indio_dev->dev.parent,
"memory alloc failed in buffer bh");
goto done; goto done;
}
if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
len = lis3l02dq_get_buffer_element(indio_dev, data); len = lis3l02dq_get_buffer_element(indio_dev, data);

View File

@ -266,10 +266,9 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
} }
us->sensebuf = kmalloc(US_SENSE_SIZE, GFP_KERNEL); us->sensebuf = kmalloc(US_SENSE_SIZE, GFP_KERNEL);
if (!us->sensebuf) { if (!us->sensebuf)
pr_info("Sense buffer allocation failed\n");
return -ENOMEM; return -ENOMEM;
}
return 0; return 0;
} }

View File

@ -233,11 +233,8 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
/* create message: */ /* create message: */
msg = kmalloc(sizeof(struct message), GFP_ATOMIC); msg = kmalloc(sizeof(struct message), GFP_ATOMIC);
if (msg == NULL)
if (msg == NULL) {
dev_err(line6->ifcdev, "Out of memory\n");
return -ENOMEM; return -ENOMEM;
}
/* create URB: */ /* create URB: */
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
@ -300,10 +297,8 @@ char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2,
{ {
char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_ATOMIC); char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_ATOMIC);
if (!buffer) { if (!buffer)
dev_err(line6->ifcdev, "out of memory\n");
return NULL; return NULL;
}
buffer[0] = LINE6_SYSEX_BEGIN; buffer[0] = LINE6_SYSEX_BEGIN;
memcpy(buffer + 1, line6_midi_id, sizeof(line6_midi_id)); memcpy(buffer + 1, line6_midi_id, sizeof(line6_midi_id));
@ -403,11 +398,8 @@ int line6_send_program(struct usb_line6 *line6, u8 value)
int partial; int partial;
buffer = kmalloc(2, GFP_KERNEL); buffer = kmalloc(2, GFP_KERNEL);
if (!buffer)
if (!buffer) {
dev_err(line6->ifcdev, "out of memory\n");
return -ENOMEM; return -ENOMEM;
}
buffer[0] = LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST; buffer[0] = LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST;
buffer[1] = value; buffer[1] = value;
@ -435,11 +427,8 @@ int line6_transmit_parameter(struct usb_line6 *line6, int param, u8 value)
int partial; int partial;
buffer = kmalloc(3, GFP_KERNEL); buffer = kmalloc(3, GFP_KERNEL);
if (!buffer)
if (!buffer) {
dev_err(line6->ifcdev, "out of memory\n");
return -ENOMEM; return -ENOMEM;
}
buffer[0] = LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST; buffer[0] = LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST;
buffer[1] = param; buffer[1] = param;
@ -834,9 +823,7 @@ static int line6_probe(struct usb_interface *interface,
} }
line6 = kzalloc(size, GFP_KERNEL); line6 = kzalloc(size, GFP_KERNEL);
if (line6 == NULL) { if (line6 == NULL) {
dev_err(&interface->dev, "Out of memory\n");
ret = -ENODEV; ret = -ENODEV;
goto err_put; goto err_put;
} }
@ -875,18 +862,14 @@ static int line6_probe(struct usb_interface *interface,
/* initialize USB buffers: */ /* initialize USB buffers: */
line6->buffer_listen = line6->buffer_listen =
kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL); kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);
if (line6->buffer_listen == NULL) { if (line6->buffer_listen == NULL) {
dev_err(&interface->dev, "Out of memory\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_destruct; goto err_destruct;
} }
line6->buffer_message = line6->buffer_message =
kmalloc(LINE6_MESSAGE_MAXLEN, GFP_KERNEL); kmalloc(LINE6_MESSAGE_MAXLEN, GFP_KERNEL);
if (line6->buffer_message == NULL) { if (line6->buffer_message == NULL) {
dev_err(&interface->dev, "Out of memory\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_destruct; goto err_destruct;
} }

View File

@ -121,10 +121,7 @@ int line6_pcm_acquire(struct snd_line6_pcm *line6pcm, int channels)
line6pcm->buffer_in = line6pcm->buffer_in =
kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS *
line6pcm->max_packet_size, GFP_KERNEL); line6pcm->max_packet_size, GFP_KERNEL);
if (!line6pcm->buffer_in) { if (!line6pcm->buffer_in) {
dev_err(line6pcm->line6->ifcdev,
"cannot malloc capture buffer\n");
err = -ENOMEM; err = -ENOMEM;
goto pcm_acquire_error; goto pcm_acquire_error;
} }
@ -160,10 +157,7 @@ int line6_pcm_acquire(struct snd_line6_pcm *line6pcm, int channels)
line6pcm->buffer_out = line6pcm->buffer_out =
kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS *
line6pcm->max_packet_size, GFP_KERNEL); line6pcm->max_packet_size, GFP_KERNEL);
if (!line6pcm->buffer_out) { if (!line6pcm->buffer_out) {
dev_err(line6pcm->line6->ifcdev,
"cannot malloc playback buffer\n");
err = -ENOMEM; err = -ENOMEM;
goto pcm_acquire_error; goto pcm_acquire_error;
} }

View File

@ -261,10 +261,8 @@ struct drm_connector *omap_connector_init(struct drm_device *dev,
omap_dss_get_device(dssdev); omap_dss_get_device(dssdev);
omap_connector = kzalloc(sizeof(struct omap_connector), GFP_KERNEL); omap_connector = kzalloc(sizeof(struct omap_connector), GFP_KERNEL);
if (!omap_connector) { if (!omap_connector)
dev_err(dev->dev, "could not allocate connector\n");
goto fail; goto fail;
}
omap_connector->dssdev = dssdev; omap_connector->dssdev = dssdev;
omap_connector->encoder = encoder; omap_connector->encoder = encoder;

View File

@ -601,11 +601,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
DBG("%s", channel_names[channel]); DBG("%s", channel_names[channel]);
omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL); omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL);
if (!omap_crtc)
if (!omap_crtc) {
dev_err(dev->dev, "could not allocate CRTC\n");
goto fail; goto fail;
}
crtc = &omap_crtc->base; crtc = &omap_crtc->base;

View File

@ -581,10 +581,8 @@ static int omap_dmm_probe(struct platform_device *dev)
struct resource *mem; struct resource *mem;
omap_dmm = kzalloc(sizeof(*omap_dmm), GFP_KERNEL); omap_dmm = kzalloc(sizeof(*omap_dmm), GFP_KERNEL);
if (!omap_dmm) { if (!omap_dmm)
dev_err(&dev->dev, "failed to allocate driver data section\n");
goto fail; goto fail;
}
/* initialize lists */ /* initialize lists */
INIT_LIST_HEAD(&omap_dmm->alloc_head); INIT_LIST_HEAD(&omap_dmm->alloc_head);
@ -681,11 +679,9 @@ static int omap_dmm_probe(struct platform_device *dev)
} }
/* alloc engines */ /* alloc engines */
omap_dmm->engines = kzalloc( omap_dmm->engines = kcalloc(omap_dmm->num_engines,
omap_dmm->num_engines * sizeof(struct refill_engine), sizeof(struct refill_engine), GFP_KERNEL);
GFP_KERNEL);
if (!omap_dmm->engines) { if (!omap_dmm->engines) {
dev_err(&dev->dev, "could not allocate engines\n");
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
} }
@ -702,10 +698,9 @@ static int omap_dmm_probe(struct platform_device *dev)
list_add(&omap_dmm->engines[i].idle_node, &omap_dmm->idle_head); list_add(&omap_dmm->engines[i].idle_node, &omap_dmm->idle_head);
} }
omap_dmm->tcm = kzalloc(omap_dmm->num_lut * sizeof(*omap_dmm->tcm), omap_dmm->tcm = kcalloc(omap_dmm->num_lut, sizeof(*omap_dmm->tcm),
GFP_KERNEL); GFP_KERNEL);
if (!omap_dmm->tcm) { if (!omap_dmm->tcm) {
dev_err(&dev->dev, "failed to allocate lut ptrs\n");
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
} }

View File

@ -335,10 +335,8 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
DBG("load: dev=%p", dev); DBG("load: dev=%p", dev);
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) { if (!priv)
dev_err(dev->dev, "could not allocate priv\n");
return -ENOMEM; return -ENOMEM;
}
priv->omaprev = pdata->omaprev; priv->omaprev = pdata->omaprev;

View File

@ -147,10 +147,8 @@ struct drm_encoder *omap_encoder_init(struct drm_device *dev,
struct omap_encoder *omap_encoder; struct omap_encoder *omap_encoder;
omap_encoder = kzalloc(sizeof(*omap_encoder), GFP_KERNEL); omap_encoder = kzalloc(sizeof(*omap_encoder), GFP_KERNEL);
if (!omap_encoder) { if (!omap_encoder)
dev_err(dev->dev, "could not allocate encoder\n");
goto fail; goto fail;
}
omap_encoder->dssdev = dssdev; omap_encoder->dssdev = dssdev;

View File

@ -418,7 +418,6 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev,
omap_fb = kzalloc(sizeof(*omap_fb), GFP_KERNEL); omap_fb = kzalloc(sizeof(*omap_fb), GFP_KERNEL);
if (!omap_fb) { if (!omap_fb) {
dev_err(dev->dev, "could not allocate fb\n");
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
} }

View File

@ -348,10 +348,8 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
int ret = 0; int ret = 0;
fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
if (!fbdev) { if (!fbdev)
dev_err(dev->dev, "could not allocate fbdev\n");
goto fail; goto fail;
}
INIT_WORK(&fbdev->work, pan_worker); INIT_WORK(&fbdev->work, pan_worker);

View File

@ -1402,10 +1402,8 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev,
} }
omap_obj = kzalloc(sizeof(*omap_obj), GFP_KERNEL); omap_obj = kzalloc(sizeof(*omap_obj), GFP_KERNEL);
if (!omap_obj) { if (!omap_obj)
dev_err(dev->dev, "could not allocate GEM object\n");
goto fail; goto fail;
}
list_add(&omap_obj->mm_list, &priv->obj_list); list_add(&omap_obj->mm_list, &priv->obj_list);
@ -1461,11 +1459,9 @@ void omap_gem_init(struct drm_device *dev)
return; return;
} }
usergart = kzalloc(3 * sizeof(*usergart), GFP_KERNEL); usergart = kcalloc(3, sizeof(*usergart), GFP_KERNEL);
if (!usergart) { if (!usergart)
dev_warn(dev->dev, "could not allocate usergart\n");
return; return;
}
/* reserve 4k aligned/wide regions for userspace mappings: */ /* reserve 4k aligned/wide regions for userspace mappings: */
for (i = 0; i < ARRAY_SIZE(fmts); i++) { for (i = 0; i < ARRAY_SIZE(fmts); i++) {

View File

@ -390,10 +390,8 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
DBG("%s: priv=%d", plane_names[id], private_plane); DBG("%s: priv=%d", plane_names[id], private_plane);
omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL); omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL);
if (!omap_plane) { if (!omap_plane)
dev_err(dev->dev, "could not allocate plane\n");
goto fail; goto fail;
}
ret = kfifo_alloc(&omap_plane->unpin_fifo, 16, GFP_KERNEL); ret = kfifo_alloc(&omap_plane->unpin_fifo, 16, GFP_KERNEL);
if (ret) { if (ret) {

View File

@ -68,10 +68,8 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
ieee->networks = kcalloc( ieee->networks = kcalloc(
MAX_NETWORK_COUNT, sizeof(struct ieee80211_network), MAX_NETWORK_COUNT, sizeof(struct ieee80211_network),
GFP_KERNEL); GFP_KERNEL);
if (!ieee->networks) { if (!ieee->networks)
netdev_warn(ieee->dev, "Out of memory allocating beacons\n");
return -ENOMEM; return -ENOMEM;
}
return 0; return 0;
} }

View File

@ -408,11 +408,9 @@ static int is_duplicate_packet(struct ieee80211_device *ieee,
// if (memcmp(entry->mac, mac, ETH_ALEN)){ // if (memcmp(entry->mac, mac, ETH_ALEN)){
if (p == &ieee->ibss_mac_hash[index]) { if (p == &ieee->ibss_mac_hash[index]) {
entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC);
if (!entry) { if (!entry)
netdev_warn(ieee->dev,
"Cannot malloc new mac entry\n");
return 0; return 0;
}
memcpy(entry->mac, mac, ETH_ALEN); memcpy(entry->mac, mac, ETH_ALEN);
entry->seq_num[tid] = seq; entry->seq_num[tid] = seq;
entry->frag_num[tid] = frag; entry->frag_num[tid] = frag;

View File

@ -315,20 +315,17 @@ static int dc_init_descriptor_list(struct channel *sc)
struct sk_buff *m; struct sk_buff *m;
if (sc->ether.rx_ring == NULL) if (sc->ether.rx_ring == NULL)
sc->ether.rx_ring = kzalloc(SBE_2T3E3_RX_DESC_RING_SIZE * sc->ether.rx_ring = kcalloc(SBE_2T3E3_RX_DESC_RING_SIZE,
sizeof(t3e3_rx_desc_t), GFP_KERNEL); sizeof(t3e3_rx_desc_t), GFP_KERNEL);
if (sc->ether.rx_ring == NULL) { if (sc->ether.rx_ring == NULL)
dev_err(&sc->pdev->dev, "SBE 2T3E3: no buffer space for RX ring\n");
return -ENOMEM; return -ENOMEM;
}
if (sc->ether.tx_ring == NULL) if (sc->ether.tx_ring == NULL)
sc->ether.tx_ring = kzalloc(SBE_2T3E3_TX_DESC_RING_SIZE * sc->ether.tx_ring = kcalloc(SBE_2T3E3_TX_DESC_RING_SIZE,
sizeof(t3e3_tx_desc_t), GFP_KERNEL); sizeof(t3e3_tx_desc_t), GFP_KERNEL);
if (sc->ether.tx_ring == NULL) { if (sc->ether.tx_ring == NULL) {
kfree(sc->ether.rx_ring); kfree(sc->ether.rx_ring);
sc->ether.rx_ring = NULL; sc->ether.rx_ring = NULL;
dev_err(&sc->pdev->dev, "SBE 2T3E3: no buffer space for RX ring\n");
return -ENOMEM; return -ENOMEM;
} }

View File

@ -154,11 +154,10 @@ static int t3e3_init_card(struct pci_dev *pdev, const struct pci_device_id *ent)
/* holds the reference for pdev1 */ /* holds the reference for pdev1 */
} }
card = kzalloc(sizeof(struct card) + channels * sizeof(struct channel), GFP_KERNEL); card = kzalloc(sizeof(struct card) + channels * sizeof(struct channel),
if (!card) { GFP_KERNEL);
dev_err(&pdev->dev, "Out of memory\n"); if (!card)
return -ENOBUFS; return -ENOBUFS;
}
spin_lock_init(&card->bootrom_lock); spin_lock_init(&card->bootrom_lock);
card->bootrom_addr = pci_resource_start(pdev, 0); card->bootrom_addr = pci_resource_start(pdev, 0);

View File

@ -178,11 +178,9 @@ static struct scatterlist *sep_alloc_sg_buf(
nbr_pages += 1; nbr_pages += 1;
} }
sg = kmalloc((sizeof(struct scatterlist) * nbr_pages), GFP_ATOMIC); sg = kmalloc_array(nbr_pages, sizeof(struct scatterlist), GFP_ATOMIC);
if (!sg) { if (!sg)
dev_warn(&sep->pdev->dev, "Cannot allocate page for new sg\n");
return NULL; return NULL;
}
sg_init_table(sg, nbr_pages); sg_init_table(sg, nbr_pages);

View File

@ -219,12 +219,8 @@ static int sep_allocate_dmatables_region(struct sep_device *sep,
dev_dbg(&sep->pdev->dev, "[PID%d] oldlen = 0x%08X\n", current->pid, dev_dbg(&sep->pdev->dev, "[PID%d] oldlen = 0x%08X\n", current->pid,
dma_ctx->dmatables_len); dma_ctx->dmatables_len);
tmp_region = kzalloc(new_len + dma_ctx->dmatables_len, GFP_KERNEL); tmp_region = kzalloc(new_len + dma_ctx->dmatables_len, GFP_KERNEL);
if (!tmp_region) { if (!tmp_region)
dev_warn(&sep->pdev->dev,
"[PID%d] no mem for dma tables region\n",
current->pid);
return -ENOMEM; return -ENOMEM;
}
/* Were there any previous tables that need to be preserved ? */ /* Were there any previous tables that need to be preserved ? */
if (*dmatables_region) { if (*dmatables_region) {
@ -1245,27 +1241,23 @@ static int sep_lock_user_pages(struct sep_device *sep,
current->pid, num_pages); current->pid, num_pages);
/* Allocate array of pages structure pointers */ /* Allocate array of pages structure pointers */
page_array = kmalloc(sizeof(struct page *) * num_pages, GFP_ATOMIC); page_array = kmalloc_array(num_pages, sizeof(struct page *),
GFP_ATOMIC);
if (!page_array) { if (!page_array) {
error = -ENOMEM; error = -ENOMEM;
goto end_function; goto end_function;
} }
map_array = kmalloc(sizeof(struct sep_dma_map) * num_pages, GFP_ATOMIC);
map_array = kmalloc_array(num_pages, sizeof(struct sep_dma_map),
GFP_ATOMIC);
if (!map_array) { if (!map_array) {
dev_warn(&sep->pdev->dev,
"[PID%d] kmalloc for map_array failed\n",
current->pid);
error = -ENOMEM; error = -ENOMEM;
goto end_function_with_error1; goto end_function_with_error1;
} }
lli_array = kmalloc(sizeof(struct sep_lli_entry) * num_pages, lli_array = kmalloc_array(num_pages, sizeof(struct sep_lli_entry),
GFP_ATOMIC); GFP_ATOMIC);
if (!lli_array) { if (!lli_array) {
dev_warn(&sep->pdev->dev,
"[PID%d] kmalloc for lli_array failed\n",
current->pid);
error = -ENOMEM; error = -ENOMEM;
goto end_function_with_error2; goto end_function_with_error2;
} }
@ -1448,15 +1440,10 @@ static int sep_lli_table_secure_dma(struct sep_device *sep,
dev_dbg(&sep->pdev->dev, "[PID%d] num_pages is (hex) %x\n", dev_dbg(&sep->pdev->dev, "[PID%d] num_pages is (hex) %x\n",
current->pid, num_pages); current->pid, num_pages);
lli_array = kmalloc(sizeof(struct sep_lli_entry) * num_pages, lli_array = kmalloc_array(num_pages, sizeof(struct sep_lli_entry),
GFP_ATOMIC); GFP_ATOMIC);
if (!lli_array)
if (!lli_array) {
dev_warn(&sep->pdev->dev,
"[PID%d] kmalloc for lli_array failed\n",
current->pid);
return -ENOMEM; return -ENOMEM;
}
/* /*
* Fill the lli_array * Fill the lli_array
@ -3419,11 +3406,9 @@ static ssize_t sep_create_dcb_dmatables_context(struct sep_device *sep,
goto end_function; goto end_function;
} }
dcb_args = kzalloc(num_dcbs * sizeof(struct build_dcb_struct), dcb_args = kcalloc(num_dcbs, sizeof(struct build_dcb_struct),
GFP_KERNEL); GFP_KERNEL);
if (!dcb_args) { if (!dcb_args) {
dev_warn(&sep->pdev->dev, "[PID%d] no memory for dcb args\n",
current->pid);
error = -ENOMEM; error = -ENOMEM;
goto end_function; goto end_function;
} }
@ -3610,9 +3595,6 @@ static ssize_t sep_create_msgarea_context(struct sep_device *sep,
/* Allocate thread-specific memory for message buffer */ /* Allocate thread-specific memory for message buffer */
*msg_region = kzalloc(msg_len, GFP_KERNEL); *msg_region = kzalloc(msg_len, GFP_KERNEL);
if (!(*msg_region)) { if (!(*msg_region)) {
dev_warn(&sep->pdev->dev,
"[PID%d] no mem for msgarea context\n",
current->pid);
error = -ENOMEM; error = -ENOMEM;
goto end_function; goto end_function;
} }
@ -4133,8 +4115,6 @@ static int sep_probe(struct pci_dev *pdev,
/* Allocate the sep_device structure for this device */ /* Allocate the sep_device structure for this device */
sep_dev = kzalloc(sizeof(struct sep_device), GFP_ATOMIC); sep_dev = kzalloc(sizeof(struct sep_device), GFP_ATOMIC);
if (sep_dev == NULL) { if (sep_dev == NULL) {
dev_warn(&pdev->dev,
"can't kmalloc the sep_device structure\n");
error = -ENOMEM; error = -ENOMEM;
goto end_function_disable_device; goto end_function_disable_device;
} }

View File

@ -95,7 +95,6 @@ int speakup_set_selection(struct tty_struct *tty)
/* Allocate a new buffer before freeing the old one ... */ /* Allocate a new buffer before freeing the old one ... */
bp = kmalloc((sel_end-sel_start)/2+1, GFP_ATOMIC); bp = kmalloc((sel_end-sel_start)/2+1, GFP_ATOMIC);
if (!bp) { if (!bp) {
dev_warn(tty->dev, "selection: kmalloc() failed\n");
speakup_clear_selection(); speakup_clear_selection();
return -ENOMEM; return -ENOMEM;
} }

View File

@ -743,12 +743,8 @@ static int synaptics_rmi4_i2c_query_device(struct synaptics_rmi4_data *pdata)
if (rmi_fd.intr_src_count) { if (rmi_fd.intr_src_count) {
rfi = kmalloc(sizeof(*rfi), rfi = kmalloc(sizeof(*rfi),
GFP_KERNEL); GFP_KERNEL);
if (!rfi) { if (!rfi)
dev_err(&client->dev,
"%s:kmalloc failed\n",
__func__);
return -ENOMEM; return -ENOMEM;
}
retval = synpatics_rmi4_touchpad_detect retval = synpatics_rmi4_touchpad_detect
(pdata, rfi, (pdata, rfi,
&rmi_fd, &rmi_fd,
@ -900,12 +896,10 @@ static int synaptics_rmi4_probe
} }
/* Allocate and initialize the instance data for this client */ /* Allocate and initialize the instance data for this client */
rmi4_data = kzalloc(sizeof(struct synaptics_rmi4_data) * 2, rmi4_data = kcalloc(2, sizeof(struct synaptics_rmi4_data),
GFP_KERNEL); GFP_KERNEL);
if (!rmi4_data) { if (!rmi4_data)
dev_err(&client->dev, "%s: no memory allocated\n", __func__);
return -ENOMEM; return -ENOMEM;
}
rmi4_data->input_dev = input_allocate_device(); rmi4_data->input_dev = input_allocate_device();
if (rmi4_data->input_dev == NULL) { if (rmi4_data->input_dev == NULL) {

View File

@ -1543,7 +1543,7 @@ u32 strmwrap_free_buffer(union trapped_args *args, void *pr_ctxt)
if (num_bufs > MAX_BUFS) if (num_bufs > MAX_BUFS)
return -EINVAL; return -EINVAL;
ap_buffer = kmalloc((num_bufs * sizeof(u8 *)), GFP_KERNEL); ap_buffer = kmalloc_array(num_bufs, sizeof(u8 *), GFP_KERNEL);
if (ap_buffer == NULL) if (ap_buffer == NULL)
return -ENOMEM; return -ENOMEM;

View File

@ -119,16 +119,14 @@ static struct dmm_map_object *add_mapping_info(struct process_context *pr_ctxt,
dsp_addr, size); dsp_addr, size);
map_obj = kzalloc(sizeof(struct dmm_map_object), GFP_KERNEL); map_obj = kzalloc(sizeof(struct dmm_map_object), GFP_KERNEL);
if (!map_obj) { if (!map_obj)
pr_err("%s: kzalloc failed\n", __func__);
return NULL; return NULL;
}
INIT_LIST_HEAD(&map_obj->link); INIT_LIST_HEAD(&map_obj->link);
map_obj->pages = kcalloc(num_usr_pgs, sizeof(struct page *), map_obj->pages = kcalloc(num_usr_pgs, sizeof(struct page *),
GFP_KERNEL); GFP_KERNEL);
if (!map_obj->pages) { if (!map_obj->pages) {
pr_err("%s: kzalloc failed\n", __func__);
kfree(map_obj); kfree(map_obj);
return NULL; return NULL;
} }
@ -693,7 +691,6 @@ static int memory_give_ownership(struct dmm_map_object *map_obj,
sg = kcalloc(num_pages, sizeof(*sg), GFP_KERNEL); sg = kcalloc(num_pages, sizeof(*sg), GFP_KERNEL);
if (!sg) { if (!sg) {
pr_err("%s: kcalloc failed\n", __func__);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
@ -1227,12 +1224,8 @@ int proc_load(void *hprocessor, const s32 argc_index,
(p_proc_object->bridge_context, &brd_state))) { (p_proc_object->bridge_context, &brd_state))) {
pr_info("%s: Processor Loaded %s\n", __func__, pargv0); pr_info("%s: Processor Loaded %s\n", __func__, pargv0);
kfree(drv_datap->base_img); kfree(drv_datap->base_img);
drv_datap->base_img = kmalloc(strlen(pargv0) + 1, drv_datap->base_img = kstrdup(pargv0, GFP_KERNEL);
GFP_KERNEL); if (!drv_datap->base_img)
if (drv_datap->base_img)
strncpy(drv_datap->base_img, pargv0,
strlen(pargv0) + 1);
else
status = -ENOMEM; status = -ENOMEM;
} }
} }

View File

@ -286,10 +286,8 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev,
/* yes, it's a new device */ /* yes, it's a new device */
sdev = kzalloc(sizeof(struct stub_device), GFP_KERNEL); sdev = kzalloc(sizeof(struct stub_device), GFP_KERNEL);
if (!sdev) { if (!sdev)
dev_err(&interface->dev, "no memory for stub_device\n");
return NULL; return NULL;
}
sdev->interface = usb_get_intf(interface); sdev->interface = usb_get_intf(interface);
sdev->udev = usb_get_dev(udev); sdev->udev = usb_get_dev(udev);

View File

@ -485,7 +485,6 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
kzalloc(pdu->u.cmd_submit.transfer_buffer_length, kzalloc(pdu->u.cmd_submit.transfer_buffer_length,
GFP_KERNEL); GFP_KERNEL);
if (!priv->urb->transfer_buffer) { if (!priv->urb->transfer_buffer) {
dev_err(&sdev->interface->dev, "malloc x_buff\n");
usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC); usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC);
return; return;
} }

View File

@ -42,7 +42,6 @@ void stub_enqueue_ret_unlink(struct stub_device *sdev, __u32 seqnum,
unlink = kzalloc(sizeof(struct stub_unlink), GFP_ATOMIC); unlink = kzalloc(sizeof(struct stub_unlink), GFP_ATOMIC);
if (!unlink) { if (!unlink) {
dev_err(&sdev->interface->dev, "alloc stub_unlink\n");
usbip_event_add(&sdev->ud, VDEV_EVENT_ERROR_MALLOC); usbip_event_add(&sdev->ud, VDEV_EVENT_ERROR_MALLOC);
return; return;
} }

View File

@ -434,16 +434,13 @@ static void vhci_tx_urb(struct urb *urb)
} }
priv = kzalloc(sizeof(struct vhci_priv), GFP_ATOMIC); priv = kzalloc(sizeof(struct vhci_priv), GFP_ATOMIC);
spin_lock(&vdev->priv_lock);
if (!priv) { if (!priv) {
dev_err(&urb->dev->dev, "malloc vhci_priv\n");
spin_unlock(&vdev->priv_lock);
usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC); usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC);
return; return;
} }
spin_lock(&vdev->priv_lock);
priv->seqnum = atomic_inc_return(&the_controller->seqnum); priv->seqnum = atomic_inc_return(&the_controller->seqnum);
if (priv->seqnum == 0xffff) if (priv->seqnum == 0xffff)
dev_info(&urb->dev->dev, "seqnum max\n"); dev_info(&urb->dev->dev, "seqnum max\n");
@ -684,7 +681,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
/* setup CMD_UNLINK pdu */ /* setup CMD_UNLINK pdu */
unlink = kzalloc(sizeof(struct vhci_unlink), GFP_ATOMIC); unlink = kzalloc(sizeof(struct vhci_unlink), GFP_ATOMIC);
if (!unlink) { if (!unlink) {
pr_err("malloc vhci_unlink\n");
spin_unlock(&vdev->priv_lock); spin_unlock(&vdev->priv_lock);
spin_unlock(&the_controller->lock); spin_unlock(&the_controller->lock);
usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC); usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC);

View File

@ -222,7 +222,6 @@ static int pio2_probe(struct vme_dev *vdev)
card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL); card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL);
if (card == NULL) { if (card == NULL) {
dev_err(&vdev->dev, "Unable to allocate card structure\n");
retval = -ENOMEM; retval = -ENOMEM;
goto err_struct; goto err_struct;
} }

View File

@ -192,10 +192,8 @@ int pio2_gpio_init(struct pio2_card *card)
char *label; char *label;
label = kmalloc(PIO2_NUM_CHANNELS, GFP_KERNEL); label = kmalloc(PIO2_NUM_CHANNELS, GFP_KERNEL);
if (label == NULL) { if (label == NULL)
dev_err(&card->vdev->dev, "Unable to allocate GPIO label\n");
return -ENOMEM; return -ENOMEM;
}
sprintf(label, "%s@%s", driver_name, dev_name(&card->vdev->dev)); sprintf(label, "%s@%s", driver_name, dev_name(&card->vdev->dev));
card->gc.label = label; card->gc.label = label;

View File

@ -761,8 +761,6 @@ static int vme_user_probe(struct vme_dev *vdev)
image[i].size_buf = PCI_BUF_SIZE; image[i].size_buf = PCI_BUF_SIZE;
image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL); image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL);
if (image[i].kern_buf == NULL) { if (image[i].kern_buf == NULL) {
dev_warn(&vdev->dev,
"Unable to allocate memory for master window buffers\n");
err = -ENOMEM; err = -ENOMEM;
goto err_master_buf; goto err_master_buf;
} }

View File

@ -1304,10 +1304,8 @@ int zcache_new_pool(uint16_t cli_id, uint32_t flags)
goto out; goto out;
atomic_inc(&cli->refcount); atomic_inc(&cli->refcount);
pool = kmalloc(sizeof(struct tmem_pool), GFP_ATOMIC); pool = kmalloc(sizeof(struct tmem_pool), GFP_ATOMIC);
if (pool == NULL) { if (pool == NULL)
pr_info("%s: pool creation failed: out of memory\n", namestr);
goto out; goto out;
}
for (poolid = 0; poolid < MAX_POOLS_PER_CLIENT; poolid++) for (poolid = 0; poolid < MAX_POOLS_PER_CLIENT; poolid++)
if (cli->tmem_pools[poolid] == NULL) if (cli->tmem_pools[poolid] == NULL)
@ -1380,10 +1378,9 @@ int zcache_autocreate_pool(unsigned int cli_id, unsigned int pool_id, bool eph)
goto out; goto out;
} }
pool = kmalloc(sizeof(struct tmem_pool), GFP_KERNEL); pool = kmalloc(sizeof(struct tmem_pool), GFP_KERNEL);
if (pool == NULL) { if (pool == NULL)
pr_info("%s: pool creation failed: out of memory\n", namestr);
goto out; goto out;
}
atomic_set(&pool->refcount, 0); atomic_set(&pool->refcount, 0);
pool->client = cli; pool->client = cli;
pool->pool_id = pool_id; pool->pool_id = pool_id;

View File

@ -246,7 +246,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
*/ */
uncmem = kmalloc(PAGE_SIZE, GFP_NOIO); uncmem = kmalloc(PAGE_SIZE, GFP_NOIO);
if (!uncmem) { if (!uncmem) {
pr_info("Error allocating temp memory!\n");
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
@ -517,10 +516,8 @@ struct zram_meta *zram_meta_alloc(u64 disksize)
goto out; goto out;
meta->compress_workmem = kzalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL); meta->compress_workmem = kzalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
if (!meta->compress_workmem) { if (!meta->compress_workmem)
pr_err("Error allocating compressor working memory!\n");
goto free_meta; goto free_meta;
}
meta->compress_buffer = meta->compress_buffer =
(void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1); (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);