--- zzzz-none-000/linux-3.10.107/drivers/platform/x86/intel_mid_thermal.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/platform/x86/intel_mid_thermal.c 2021-02-04 17:41:59.000000000 +0000 @@ -132,7 +132,7 @@ * to achieve very close approximate temp value with less than * 0.5C error */ -static int adc_to_temp(int direct, uint16_t adc_val, unsigned long *tp) +static int adc_to_temp(int direct, uint16_t adc_val, int *tp) { int temp; @@ -174,14 +174,13 @@ * * Can sleep */ -static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp) +static int mid_read_temp(struct thermal_zone_device *tzd, int *temp) { struct thermal_device_info *td_info = tzd->devdata; uint16_t adc_val, addr; uint8_t data = 0; int ret; - unsigned long curr_temp; - + int curr_temp; addr = td_info->chnl_addr; @@ -453,7 +452,7 @@ * * Can sleep */ -static int read_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp) +static int read_curr_temp(struct thermal_zone_device *tzd, int *temp) { WARN_ON(tzd == NULL); return mid_read_temp(tzd, temp); @@ -481,7 +480,8 @@ int i; struct platform_info *pinfo; - pinfo = kzalloc(sizeof(struct platform_info), GFP_KERNEL); + pinfo = devm_kzalloc(&pdev->dev, sizeof(struct platform_info), + GFP_KERNEL); if (!pinfo) return -ENOMEM; @@ -489,7 +489,6 @@ ret = mid_initialize_adc(&pdev->dev); if (ret) { dev_err(&pdev->dev, "ADC init failed"); - kfree(pinfo); return ret; } @@ -520,7 +519,6 @@ thermal_zone_device_unregister(pinfo->tzd[i]); } configure_adc(0); - kfree(pinfo); return ret; } @@ -541,9 +539,6 @@ thermal_zone_device_unregister(pinfo->tzd[i]); } - kfree(pinfo); - platform_set_drvdata(pdev, NULL); - /* Stop the ADC */ return configure_adc(0); } @@ -559,7 +554,6 @@ static struct platform_driver mid_thermal_driver = { .driver = { .name = DRIVER_NAME, - .owner = THIS_MODULE, .pm = &mid_thermal_pm, }, .probe = mid_thermal_probe,