mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
thermal: tsens8974: Fix NULL pointer dereference
Dereference the thermal device pointer only after checking that it is valid. Change-Id: I5619b14f2d37969e59a16a64b6011c1dba9b2e15 Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
This commit is contained in:
parent
8f5cb3f56b
commit
4a26cc02e3
1 changed files with 3 additions and 1 deletions
|
@ -771,7 +771,7 @@ fail:
|
|||
|
||||
static int __devinit _tsens_register_thermal(void)
|
||||
{
|
||||
struct platform_device *pdev = tmdev->pdev;
|
||||
struct platform_device *pdev;
|
||||
int rc, i;
|
||||
|
||||
if (!tmdev) {
|
||||
|
@ -779,6 +779,8 @@ static int __devinit _tsens_register_thermal(void)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
pdev = tmdev->pdev;
|
||||
|
||||
for (i = 0; i < tmdev->tsens_num_sensor; i++) {
|
||||
char name[18];
|
||||
snprintf(name, sizeof(name), "tsens_tz_sensor%d", i);
|
||||
|
|
Loading…
Reference in a new issue