X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Fhwmon%2Fnct6775.c;h=59d9a3fc96b70cd828c29b66ced2021ceeaa9ca4;hb=046f153343e33dcad1be7f6249ea6ff1c6fd9b58;hp=38d5a63340535567719feb35338712570a2c88d2;hpb=f18eb31f9df52c28ec86d18d72f66ef689878daa;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index 38d5a6334053..59d9a3fc96b7 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c @@ -4160,7 +4160,7 @@ static int __init sensors_nct6775_init(void) pdev[i] = platform_device_alloc(DRVNAME, address); if (!pdev[i]) { err = -ENOMEM; - goto exit_device_put; + goto exit_device_unregister; } err = platform_device_add_data(pdev[i], &sio_data, @@ -4198,9 +4198,11 @@ static int __init sensors_nct6775_init(void) return 0; exit_device_put: - for (i = 0; i < ARRAY_SIZE(pdev); i++) { + platform_device_put(pdev[i]); +exit_device_unregister: + while (--i >= 0) { if (pdev[i]) - platform_device_put(pdev[i]); + platform_device_unregister(pdev[i]); } exit_unregister: platform_driver_unregister(&nct6775_driver);