This patch solves the Coccinelle warning: "kzalloc should be used
instead of kmalloc/memset"
This patch is a fixup for
linux-next:
97a84f1203786985856a0d4b49b1d7cc387238ce
"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: Silvio F <silvio.fricke@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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
* correctly at DEVICE_CREATE time, INSTEAD OF waiting until
* DEVICE_CONFIGURE time.
struct diskaddremove *dar;
unsigned long flags;
- dar = kmalloc(sizeof(struct diskaddremove), GFP_ATOMIC);
+ dar = kzalloc(sizeof(struct diskaddremove), GFP_ATOMIC);
if (dar) {
- memset(dar, 0, sizeof(struct diskaddremove));
dar->add = cmdrsp->disknotify.add;
dar->shost = shost;
dar->channel = cmdrsp->disknotify.channel;
return FAILED;
}
- ALLOC_CMDRSP(cmdrsp);
+ cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
if (cmdrsp == NULL) {
LOGERR("kmalloc of cmdrsp failed.\n");
return FAILED; /* reject */
return FAILED;
}
- ALLOC_CMDRSP(cmdrsp);
+ cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
if (cmdrsp == NULL) {
LOGERR("kmalloc of cmdrsp failed.\n");
return FAILED; /* reject */
return SCSI_MLQUEUE_DEVICE_BUSY;
}
- ALLOC_CMDRSP(cmdrsp);
+ cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
if (cmdrsp == NULL) {
LOGERR("kmalloc of cmdrsp failed.\n");
return 1; /* reject the command */
{
int ret;
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);
if (!vbus)
return 0;
- memset(vbus, 0, sizeof(struct device));
dev_set_name(vbus, "vbus%d", addparams->busNo);
vbus->release = virtpci_bus_release;
vbus->parent = &virtpci_rootbus_device; /* root bus is parent */
visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes)
{
MEMREGION *rc = NULL;
- MEMREGION *memregion = kmalloc(sizeof(MEMREGION),
- GFP_KERNEL|__GFP_NORETRY);
+ MEMREGION *memregion = kzalloc(sizeof(MEMREGION),
+ GFP_KERNEL | __GFP_NORETRY);
if (memregion == NULL) {
ERRDRV("visor_memregion_create allocation failed");
return NULL;
}
- memset(memregion, 0, sizeof(MEMREGION));
memregion->physaddr = physaddr;
memregion->nbytes = nbytes;
memregion->overlapped = FALSE;
void *workfuncarg,
const char *devnam)
{
- PERIODIC_WORK *periodic_work = kmalloc(sizeof(PERIODIC_WORK),
- GFP_KERNEL|__GFP_NORETRY);
+ PERIODIC_WORK *periodic_work = kzalloc(sizeof(PERIODIC_WORK),
+ GFP_KERNEL | __GFP_NORETRY);
if (periodic_work == NULL) {
ERRDRV("periodic_work allocation failed ");
return NULL;
}
- memset(periodic_work, '\0', sizeof(PERIODIC_WORK));
rwlock_init(&periodic_work->lock);
periodic_work->jiffy_interval = jiffy_interval;
periodic_work->workqueue = workqueue;