malloc to calloc
This commit is contained in:
@@ -287,10 +287,9 @@ x54x_bios_scsi_command(scsi_device_t *dev, uint8_t *cdb, uint8_t *buf, int len,
|
||||
static uint8_t
|
||||
x54x_bios_read_capacity(scsi_device_t *sd, uint8_t *buf, int transfer_size)
|
||||
{
|
||||
uint8_t *cdb;
|
||||
uint8_t *cdb = (uint8_t *) malloc(12);;
|
||||
uint8_t ret;
|
||||
|
||||
cdb = (uint8_t *) malloc(12);
|
||||
memset(cdb, 0, 12);
|
||||
cdb[0] = GPCMD_READ_CDROM_CAPACITY;
|
||||
|
||||
@@ -305,10 +304,9 @@ x54x_bios_read_capacity(scsi_device_t *sd, uint8_t *buf, int transfer_size)
|
||||
static uint8_t
|
||||
x54x_bios_inquiry(scsi_device_t *sd, uint8_t *buf, int transfer_size)
|
||||
{
|
||||
uint8_t *cdb;
|
||||
uint8_t *cdb = (uint8_t *) malloc(12);
|
||||
uint8_t ret;
|
||||
|
||||
cdb = (uint8_t *) malloc(12);
|
||||
memset(cdb, 0, 12);
|
||||
cdb[0] = GPCMD_INQUIRY;
|
||||
cdb[4] = 36;
|
||||
@@ -324,14 +322,13 @@ x54x_bios_inquiry(scsi_device_t *sd, uint8_t *buf, int transfer_size)
|
||||
static uint8_t
|
||||
x54x_bios_command_08(scsi_device_t *sd, uint8_t *buffer, int transfer_size)
|
||||
{
|
||||
uint8_t *rcbuf;
|
||||
uint8_t *rcbuf = (uint8_t *) malloc(8);
|
||||
uint8_t ret;
|
||||
int i;
|
||||
|
||||
memset(buffer, 0x00, 6);
|
||||
|
||||
rcbuf = (uint8_t *) malloc(8);
|
||||
ret = x54x_bios_read_capacity(sd, rcbuf, transfer_size);
|
||||
ret = x54x_bios_read_capacity(sd, rcbuf, transfer_size);
|
||||
if (ret) {
|
||||
free(rcbuf);
|
||||
return ret;
|
||||
@@ -353,13 +350,12 @@ x54x_bios_command_08(scsi_device_t *sd, uint8_t *buffer, int transfer_size)
|
||||
static int
|
||||
x54x_bios_command_15(scsi_device_t *sd, uint8_t *buffer, int transfer_size)
|
||||
{
|
||||
uint8_t *inqbuf;
|
||||
uint8_t *inqbuf = (uint8_t *) malloc(36);
|
||||
uint8_t *rcbuf;
|
||||
uint8_t ret;
|
||||
|
||||
memset(buffer, 0x00, 6);
|
||||
|
||||
inqbuf = (uint8_t *) malloc(36);
|
||||
ret = x54x_bios_inquiry(sd, inqbuf, transfer_size);
|
||||
if (ret) {
|
||||
free(inqbuf);
|
||||
@@ -1896,13 +1892,11 @@ x54x_mem_disable(x54x_t *dev)
|
||||
void *
|
||||
x54x_init(const device_t *info)
|
||||
{
|
||||
x54x_t *dev;
|
||||
x54x_t *dev = calloc(1, sizeof(x54x_t));
|
||||
|
||||
/* Allocate control block and set up basic stuff. */
|
||||
dev = malloc(sizeof(x54x_t));
|
||||
if (dev == NULL)
|
||||
return dev;
|
||||
memset(dev, 0x00, sizeof(x54x_t));
|
||||
dev->type = info->local;
|
||||
|
||||
dev->card_bus = info->flags;
|
||||
|
||||
Reference in New Issue
Block a user