stm class: Fix channel bitmap on 32-bit systems
[linux-2.6-microblaze.git] / drivers / hwtracing / stm / core.c
index 5b5807c..e55b902 100644 (file)
@@ -166,11 +166,10 @@ stm_master(struct stm_device *stm, unsigned int idx)
 static int stp_master_alloc(struct stm_device *stm, unsigned int idx)
 {
        struct stp_master *master;
-       size_t size;
 
-       size = ALIGN(stm->data->sw_nchannels, 8) / 8;
-       size += sizeof(struct stp_master);
-       master = kzalloc(size, GFP_ATOMIC);
+       master = kzalloc(struct_size(master, chan_map,
+                                    BITS_TO_LONGS(stm->data->sw_nchannels)),
+                        GFP_ATOMIC);
        if (!master)
                return -ENOMEM;