diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index cf5b1de32c0a01d9d42018f4041b0550661c7acd..9323837866422c181df7bee75b48cd7693db7bc2 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -506,6 +506,7 @@ static int create_core_data(struct platform_device *pdev,
 
 	return 0;
 exit_free:
+	pdata->core_data[attr_no] = NULL;
 	kfree(tdata);
 	return err;
 }