diff options
author | Silvio F <silvio.fricke@gmail.com> | 2014-03-18 17:13:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-18 19:22:27 -0400 |
commit | a3acc83a4a2b8e1a6f8f3c5bdcfa3bb5f5f9e338 (patch) | |
tree | 00eacbe7ed72aa0833bf9b03cd9ff60cff54b7dd | |
parent | 3e67dee2f6ae7096802a49a16c79fc6adda3a540 (diff) |
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: 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>
-rw-r--r-- | drivers/staging/unisys/include/uisutils.h | 7 | ||||
-rw-r--r-- | drivers/staging/unisys/virthba/virthba.c | 9 | ||||
-rw-r--r-- | drivers/staging/unisys/virtpci/virtpci.c | 3 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/memregion_direct.c | 5 | ||||
-rw-r--r-- | drivers/staging/unisys/visorutil/periodic_work.c | 5 |
5 files changed, 9 insertions, 20 deletions
diff --git a/drivers/staging/unisys/include/uisutils.h b/drivers/staging/unisys/include/uisutils.h index 81b5d9baea5c..effd8935e81b 100644 --- a/drivers/staging/unisys/include/uisutils.h +++ b/drivers/staging/unisys/include/uisutils.h | |||
@@ -189,13 +189,6 @@ struct chaninfo { | |||
189 | schedule_timeout((x)*HZ); \ | 189 | schedule_timeout((x)*HZ); \ |
190 | } | 190 | } |
191 | 191 | ||
192 | #define ALLOC_CMDRSP(cmdrsp) { \ | ||
193 | cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC); \ | ||
194 | if (cmdrsp != NULL) { \ | ||
195 | memset(cmdrsp, 0, SIZEOF_CMDRSP); \ | ||
196 | } \ | ||
197 | } | ||
198 | |||
199 | /* This is a hack until we fix IOVM to initialize the channel header | 192 | /* This is a hack until we fix IOVM to initialize the channel header |
200 | * correctly at DEVICE_CREATE time, INSTEAD OF waiting until | 193 | * correctly at DEVICE_CREATE time, INSTEAD OF waiting until |
201 | * DEVICE_CONFIGURE time. | 194 | * DEVICE_CONFIGURE time. |
diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index 8aefaa8d36bf..817b11dfa19c 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c | |||
@@ -402,9 +402,8 @@ process_disk_notify(struct Scsi_Host *shost, struct uiscmdrsp *cmdrsp) | |||
402 | struct diskaddremove *dar; | 402 | struct diskaddremove *dar; |
403 | unsigned long flags; | 403 | unsigned long flags; |
404 | 404 | ||
405 | dar = kmalloc(sizeof(struct diskaddremove), GFP_ATOMIC); | 405 | dar = kzalloc(sizeof(struct diskaddremove), GFP_ATOMIC); |
406 | if (dar) { | 406 | if (dar) { |
407 | memset(dar, 0, sizeof(struct diskaddremove)); | ||
408 | dar->add = cmdrsp->disknotify.add; | 407 | dar->add = cmdrsp->disknotify.add; |
409 | dar->shost = shost; | 408 | dar->shost = shost; |
410 | dar->channel = cmdrsp->disknotify.channel; | 409 | dar->channel = cmdrsp->disknotify.channel; |
@@ -697,7 +696,7 @@ forward_vdiskmgmt_command(VDISK_MGMT_TYPES vdiskcmdtype, | |||
697 | return FAILED; | 696 | return FAILED; |
698 | } | 697 | } |
699 | 698 | ||
700 | ALLOC_CMDRSP(cmdrsp); | 699 | cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); |
701 | if (cmdrsp == NULL) { | 700 | if (cmdrsp == NULL) { |
702 | LOGERR("kmalloc of cmdrsp failed.\n"); | 701 | LOGERR("kmalloc of cmdrsp failed.\n"); |
703 | return FAILED; /* reject */ | 702 | return FAILED; /* reject */ |
@@ -759,7 +758,7 @@ forward_taskmgmt_command(TASK_MGMT_TYPES tasktype, struct scsi_device *scsidev) | |||
759 | return FAILED; | 758 | return FAILED; |
760 | } | 759 | } |
761 | 760 | ||
762 | ALLOC_CMDRSP(cmdrsp); | 761 | cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); |
763 | if (cmdrsp == NULL) { | 762 | if (cmdrsp == NULL) { |
764 | LOGERR("kmalloc of cmdrsp failed.\n"); | 763 | LOGERR("kmalloc of cmdrsp failed.\n"); |
765 | return FAILED; /* reject */ | 764 | return FAILED; /* reject */ |
@@ -930,7 +929,7 @@ virthba_queue_command_lck(struct scsi_cmnd *scsicmd, | |||
930 | return SCSI_MLQUEUE_DEVICE_BUSY; | 929 | return SCSI_MLQUEUE_DEVICE_BUSY; |
931 | } | 930 | } |
932 | 931 | ||
933 | ALLOC_CMDRSP(cmdrsp); | 932 | cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC); |
934 | if (cmdrsp == NULL) { | 933 | if (cmdrsp == NULL) { |
935 | LOGERR("kmalloc of cmdrsp failed.\n"); | 934 | LOGERR("kmalloc of cmdrsp failed.\n"); |
936 | return 1; /* reject the command */ | 935 | return 1; /* reject the command */ |
diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index 1b646328839e..8e34650b00b5 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c | |||
@@ -254,13 +254,12 @@ static int add_vbus(struct add_vbus_guestpart *addparams) | |||
254 | { | 254 | { |
255 | int ret; | 255 | int ret; |
256 | struct device *vbus; | 256 | struct device *vbus; |
257 | vbus = kmalloc(sizeof(struct device), GFP_ATOMIC); | 257 | vbus = kzalloc(sizeof(struct device), GFP_ATOMIC); |
258 | 258 | ||
259 | POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); | 259 | POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO); |
260 | if (!vbus) | 260 | if (!vbus) |
261 | return 0; | 261 | return 0; |
262 | 262 | ||
263 | memset(vbus, 0, sizeof(struct device)); | ||
264 | dev_set_name(vbus, "vbus%d", addparams->busNo); | 263 | dev_set_name(vbus, "vbus%d", addparams->busNo); |
265 | vbus->release = virtpci_bus_release; | 264 | vbus->release = virtpci_bus_release; |
266 | vbus->parent = &virtpci_rootbus_device; /* root bus is parent */ | 265 | vbus->parent = &virtpci_rootbus_device; /* root bus is parent */ |
diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index 82c651d27396..b9b61e8a8e71 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c | |||
@@ -41,13 +41,12 @@ MEMREGION * | |||
41 | visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) | 41 | visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) |
42 | { | 42 | { |
43 | MEMREGION *rc = NULL; | 43 | MEMREGION *rc = NULL; |
44 | MEMREGION *memregion = kmalloc(sizeof(MEMREGION), | 44 | MEMREGION *memregion = kzalloc(sizeof(MEMREGION), |
45 | GFP_KERNEL|__GFP_NORETRY); | 45 | GFP_KERNEL | __GFP_NORETRY); |
46 | if (memregion == NULL) { | 46 | if (memregion == NULL) { |
47 | ERRDRV("visor_memregion_create allocation failed"); | 47 | ERRDRV("visor_memregion_create allocation failed"); |
48 | return NULL; | 48 | return NULL; |
49 | } | 49 | } |
50 | memset(memregion, 0, sizeof(MEMREGION)); | ||
51 | memregion->physaddr = physaddr; | 50 | memregion->physaddr = physaddr; |
52 | memregion->nbytes = nbytes; | 51 | memregion->nbytes = nbytes; |
53 | memregion->overlapped = FALSE; | 52 | memregion->overlapped = FALSE; |
diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index cc1c678a3b03..fb1e894ebdc1 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c | |||
@@ -56,13 +56,12 @@ PERIODIC_WORK *visor_periodic_work_create(ulong jiffy_interval, | |||
56 | void *workfuncarg, | 56 | void *workfuncarg, |
57 | const char *devnam) | 57 | const char *devnam) |
58 | { | 58 | { |
59 | PERIODIC_WORK *periodic_work = kmalloc(sizeof(PERIODIC_WORK), | 59 | PERIODIC_WORK *periodic_work = kzalloc(sizeof(PERIODIC_WORK), |
60 | GFP_KERNEL|__GFP_NORETRY); | 60 | GFP_KERNEL | __GFP_NORETRY); |
61 | if (periodic_work == NULL) { | 61 | if (periodic_work == NULL) { |
62 | ERRDRV("periodic_work allocation failed "); | 62 | ERRDRV("periodic_work allocation failed "); |
63 | return NULL; | 63 | return NULL; |
64 | } | 64 | } |
65 | memset(periodic_work, '\0', sizeof(PERIODIC_WORK)); | ||
66 | rwlock_init(&periodic_work->lock); | 65 | rwlock_init(&periodic_work->lock); |
67 | periodic_work->jiffy_interval = jiffy_interval; | 66 | periodic_work->jiffy_interval = jiffy_interval; |
68 | periodic_work->workqueue = workqueue; | 67 | periodic_work->workqueue = workqueue; |