• Kylene Jo Hall's avatar
    [PATCH] tpm: Fix lack of driver_unregister in init failcases · e2a8f7a1
    Kylene Jo Hall authored
    driver_unregister is not being properly called when the init function
    returns an error case.  Restructured the return logic such that this and
    the other cleanups all happen in one place.  Preformed many of the cleanups
    that Andrew Morton's patch on Thursday made in tpm_atmel.c.  Fixed
    Matthieu's concern about writing before discovery.
    
    (akpm: rmk said:
    
    This driver is buggy.  You must not provide your own release function - it
    doesn't solve the problem which the warning (which you get when you don't
    provide one) is telling you about.
    
    You should convert your device driver over to the replacement dynamic platform
    support, once it is merged.  IOW, something like:
    
    	pdev = platform_device_alloc("mydev", id);
    	if (pdev) {
    		err = platform_device_add_resources(pdev, &resources,
    						ARRAY_SIZE(resources));
    		if (err == 0)
    			err = platform_device_add_data(pdev, &platform_data,
    						sizeof(platform_data));
    		if (err == 0)
    			err = platform_device_add(pdev);
    		} else {
    			err = -ENOMEM;
    		}
    		if (err)
    			platform_device_put(pdev);
    )
    Signed-off-by: default avatarKylene Jo Hall <kjhall@us.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    e2a8f7a1
tpm_nsc.c 9.73 KB