[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH] ata: Initialize ata_device to 0



* struct ata_device inherits cdi_storage_device or cdi_scsi_device.
  Since this driver does not know all of the fields contained therein
  for sure, the object has to be initialized to 0.

Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
 ata/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ata/device.c b/ata/device.c
index 9afa102..a287f1e 100644
--- a/ata/device.c
+++ b/ata/device.c
@@ -222,7 +222,7 @@ void ata_init_controller(struct ata_controller* controller)
     // Jetzt werden die einzelnen geraete identifiziert. Hier ist es
     // anscheinend geschickter mit dem Slave zu beginnen.
     for (i = 1; i >= 0; i--) {
-        struct ata_device* dev = malloc(sizeof(*dev));
+        struct ata_device* dev = calloc(1, sizeof(*dev));
         dev->controller = controller;
         dev->id = i;
         dev->partition_list = cdi_list_create();
-- 
2.6.3