lib: g_malloc never fails
Or rather, it never returns errors and aborts instead if memory cannot be allocated, so remove code that handled failures. https://bugs.freedesktop.org/show_bug.cgi?id=57869
This commit is contained in:
parent
1acd647b29
commit
6d65bfcf80
4 changed files with 0 additions and 26 deletions
|
@ -48,16 +48,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
|
|||
}
|
||||
|
||||
dev->priv = aesdev = g_malloc0(sizeof(struct aesX660_dev));
|
||||
if (!aesdev)
|
||||
return -ENOMEM;
|
||||
|
||||
aesdev->buffer = g_malloc0(AES1660_FRAME_SIZE + AESX660_HEADER_SIZE);
|
||||
if (!aesdev->buffer) {
|
||||
g_free(aesdev);
|
||||
dev->priv = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
aesdev->h_scale_factor = SCALE_FACTOR;
|
||||
aesdev->init_seqs[0] = aes1660_init_1;
|
||||
aesdev->init_seqs_len[0] = array_n_elements(aes1660_init_1);
|
||||
|
|
|
@ -215,10 +215,6 @@ static int process_strip_data(struct fpi_ssm *ssm, unsigned char *data)
|
|||
fp_dbg("Bogus frame len: %.4x\n", len);
|
||||
}
|
||||
stripdata = g_malloc(FRAME_WIDTH * FRAME_HEIGHT / 2); /* 4 bits per pixel */
|
||||
if (!stripdata) {
|
||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memcpy(stripdata, data + 33, FRAME_WIDTH * FRAME_HEIGHT / 2);
|
||||
aesdev->strips = g_slist_prepend(aesdev->strips, stripdata);
|
||||
aesdev->strips_len++;
|
||||
|
|
|
@ -47,16 +47,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
|
|||
}
|
||||
|
||||
dev->priv = aesdev = g_malloc0(sizeof(struct aesX660_dev));
|
||||
if (!aesdev)
|
||||
return -ENOMEM;
|
||||
|
||||
aesdev->buffer = g_malloc0(AES2660_FRAME_SIZE + AESX660_HEADER_SIZE);
|
||||
if (!aesdev->buffer) {
|
||||
g_free(aesdev);
|
||||
dev->priv = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* No scaling for AES2660 */
|
||||
aesdev->h_scale_factor = 1;
|
||||
aesdev->init_seqs[0] = aes2660_init_1;
|
||||
|
|
|
@ -278,10 +278,6 @@ static int process_stripe_data(struct fpi_ssm *ssm, unsigned char *data)
|
|||
struct aesX660_dev *aesdev = dev->priv;
|
||||
|
||||
stripdata = g_malloc(aesdev->frame_width * FRAME_HEIGHT / 2); /* 4 bits per pixel */
|
||||
if (!stripdata) {
|
||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fp_dbg("Processing frame %.2x %.2x", data[AESX660_IMAGE_OK_OFFSET],
|
||||
data[AESX660_LAST_FRAME_OFFSET]);
|
||||
|
|
Loading…
Reference in a new issue