]> err.no Git - linux-2.6/commitdiff
doc firmware_sample_firmware_class.c: kmalloc + memset conversion to kzalloc
authorMariusz Kozlowski <m.kozlowski@tuxland.pl>
Wed, 17 Oct 2007 06:26:44 +0000 (23:26 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 17 Oct 2007 15:42:50 +0000 (08:42 -0700)
 Documentation/firmware_class/firmware_sample_firmware_class.c | 5246 -> 5211 (-35 bytes)

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Documentation/firmware_class/firmware_sample_firmware_class.c

index fba943aacf93e2a8b040996bf26c408ee737e1a3..2de62854f0e5c90aa6643b0b72d59cc8e96758f7 100644 (file)
@@ -109,15 +109,15 @@ static int fw_setup_class_device(struct class_device *class_dev,
                                 const char *fw_name,
                                 struct device *device)
 {
-       int retval = 0;
-       struct firmware_priv *fw_priv = kmalloc(sizeof(struct firmware_priv),
-                                               GFP_KERNEL);
+       int retval;
+       struct firmware_priv *fw_priv;
 
-       if(!fw_priv){
+       fw_priv = kzalloc(sizeof(struct firmware_priv), GFP_KERNEL);
+       if (!fw_priv) {
                retval = -ENOMEM;
                goto out;
        }
-       memset(fw_priv, 0, sizeof(*fw_priv));
+
        memset(class_dev, 0, sizeof(*class_dev));
 
        strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX);