Commit a3acc83a authored by Silvio F's avatar Silvio F Committed by Greg Kroah-Hartman

staging: unisys: kmalloc/memset to kzalloc conversation

This patch solves the Coccinelle warning: "kzalloc should be used
instead of kmalloc/memset"

This patch is a fixup for

	linux-next: 97a84f12
	"Staging: unisys: Replace kmalloc/memset with kzalloc"

The ALLOC_CMDRSP #define is after transformation to kzalloc only a
rename for kzalloc and was completly removed.
Signed-off-by: default avatarSilvio F <silvio.fricke@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3e67dee2
...@@ -189,13 +189,6 @@ struct chaninfo { ...@@ -189,13 +189,6 @@ struct chaninfo {
schedule_timeout((x)*HZ); \ schedule_timeout((x)*HZ); \
} }
#define ALLOC_CMDRSP(cmdrsp) { \
cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC); \
if (cmdrsp != NULL) { \
memset(cmdrsp, 0, SIZEOF_CMDRSP); \
} \
}
/* This is a hack until we fix IOVM to initialize the channel header /* This is a hack until we fix IOVM to initialize the channel header
* correctly at DEVICE_CREATE time, INSTEAD OF waiting until * correctly at DEVICE_CREATE time, INSTEAD OF waiting until
* DEVICE_CONFIGURE time. * DEVICE_CONFIGURE time.
......
...@@ -402,9 +402,8 @@ process_disk_notify(struct Scsi_Host *shost, struct uiscmdrsp *cmdrsp) ...@@ -402,9 +402,8 @@ process_disk_notify(struct Scsi_Host *shost, struct uiscmdrsp *cmdrsp)
struct diskaddremove *dar; struct diskaddremove *dar;
unsigned long flags; unsigned long flags;
dar = kmalloc(sizeof(struct diskaddremove), GFP_ATOMIC); dar = kzalloc(sizeof(struct diskaddremove), GFP_ATOMIC);
if (dar) { if (dar) {
memset(dar, 0, sizeof(struct diskaddremove));
dar->add = cmdrsp->disknotify.add; dar->add = cmdrsp->disknotify.add;
dar->shost = shost; dar->shost = shost;
dar->channel = cmdrsp->disknotify.channel; dar->channel = cmdrsp->disknotify.channel;
...@@ -697,7 +696,7 @@ forward_vdiskmgmt_command(VDISK_MGMT_TYPES vdiskcmdtype, ...@@ -697,7 +696,7 @@ forward_vdiskmgmt_command(VDISK_MGMT_TYPES vdiskcmdtype,
return FAILED; return FAILED;
} }
ALLOC_CMDRSP(cmdrsp); cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
if (cmdrsp == NULL) { if (cmdrsp == NULL) {
LOGERR("kmalloc of cmdrsp failed.\n"); LOGERR("kmalloc of cmdrsp failed.\n");
return FAILED; /* reject */ return FAILED; /* reject */
...@@ -759,7 +758,7 @@ forward_taskmgmt_command(TASK_MGMT_TYPES tasktype, struct scsi_device *scsidev) ...@@ -759,7 +758,7 @@ forward_taskmgmt_command(TASK_MGMT_TYPES tasktype, struct scsi_device *scsidev)
return FAILED; return FAILED;
} }
ALLOC_CMDRSP(cmdrsp); cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
if (cmdrsp == NULL) { if (cmdrsp == NULL) {
LOGERR("kmalloc of cmdrsp failed.\n"); LOGERR("kmalloc of cmdrsp failed.\n");
return FAILED; /* reject */ return FAILED; /* reject */
...@@ -930,7 +929,7 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, ...@@ -930,7 +929,7 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
return SCSI_MLQUEUE_DEVICE_BUSY; return SCSI_MLQUEUE_DEVICE_BUSY;
} }
ALLOC_CMDRSP(cmdrsp); cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
if (cmdrsp == NULL) { if (cmdrsp == NULL) {
LOGERR("kmalloc of cmdrsp failed.\n"); LOGERR("kmalloc of cmdrsp failed.\n");
return 1; /* reject the command */ return 1; /* reject the command */
......
...@@ -254,13 +254,12 @@ static int add_vbus(struct add_vbus_guestpart *addparams) ...@@ -254,13 +254,12 @@ static int add_vbus(struct add_vbus_guestpart *addparams)
{ {
int ret; int ret;
struct device *vbus; struct device *vbus;
vbus = kmalloc(sizeof(struct device), GFP_ATOMIC); vbus = kzalloc(sizeof(struct device), GFP_ATOMIC);
POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
if (!vbus) if (!vbus)
return 0; return 0;
memset(vbus, 0, sizeof(struct device));
dev_set_name(vbus, "vbus%d", addparams->busNo); dev_set_name(vbus, "vbus%d", addparams->busNo);
vbus->release = virtpci_bus_release; vbus->release = virtpci_bus_release;
vbus->parent = &virtpci_rootbus_device; /* root bus is parent */ vbus->parent = &virtpci_rootbus_device; /* root bus is parent */
......
...@@ -41,13 +41,12 @@ MEMREGION * ...@@ -41,13 +41,12 @@ MEMREGION *
visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes)
{ {
MEMREGION *rc = NULL; MEMREGION *rc = NULL;
MEMREGION *memregion = kmalloc(sizeof(MEMREGION), MEMREGION *memregion = kzalloc(sizeof(MEMREGION),
GFP_KERNEL|__GFP_NORETRY); GFP_KERNEL | __GFP_NORETRY);
if (memregion == NULL) { if (memregion == NULL) {
ERRDRV("visor_memregion_create allocation failed"); ERRDRV("visor_memregion_create allocation failed");
return NULL; return NULL;
} }
memset(memregion, 0, sizeof(MEMREGION));
memregion->physaddr = physaddr; memregion->physaddr = physaddr;
memregion->nbytes = nbytes; memregion->nbytes = nbytes;
memregion->overlapped = FALSE; memregion->overlapped = FALSE;
......
...@@ -56,13 +56,12 @@ PERIODIC_WORK *visor_periodic_work_create(ulong jiffy_interval, ...@@ -56,13 +56,12 @@ PERIODIC_WORK *visor_periodic_work_create(ulong jiffy_interval,
void *workfuncarg, void *workfuncarg,
const char *devnam) const char *devnam)
{ {
PERIODIC_WORK *periodic_work = kmalloc(sizeof(PERIODIC_WORK), PERIODIC_WORK *periodic_work = kzalloc(sizeof(PERIODIC_WORK),
GFP_KERNEL|__GFP_NORETRY); GFP_KERNEL | __GFP_NORETRY);
if (periodic_work == NULL) { if (periodic_work == NULL) {
ERRDRV("periodic_work allocation failed "); ERRDRV("periodic_work allocation failed ");
return NULL; return NULL;
} }
memset(periodic_work, '\0', sizeof(PERIODIC_WORK));
rwlock_init(&periodic_work->lock); rwlock_init(&periodic_work->lock);
periodic_work->jiffy_interval = jiffy_interval; periodic_work->jiffy_interval = jiffy_interval;
periodic_work->workqueue = workqueue; periodic_work->workqueue = workqueue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment