Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6aa85f11
Commit
6aa85f11
authored
May 26, 2016
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/iccsense: fix memory leak
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
539aae6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
+9
-7
No files found.
drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
View file @
6aa85f11
...
@@ -276,6 +276,8 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
...
@@ -276,6 +276,8 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
struct
pwr_rail_t
*
r
=
&
stbl
.
rail
[
i
];
struct
pwr_rail_t
*
r
=
&
stbl
.
rail
[
i
];
struct
nvkm_iccsense_rail
*
rail
;
struct
nvkm_iccsense_rail
*
rail
;
struct
nvkm_iccsense_sensor
*
sensor
;
struct
nvkm_iccsense_sensor
*
sensor
;
int
(
*
read
)(
struct
nvkm_iccsense
*
,
struct
nvkm_iccsense_rail
*
);
if
(
!
r
->
mode
||
r
->
resistor_mohm
==
0
)
if
(
!
r
->
mode
||
r
->
resistor_mohm
==
0
)
continue
;
continue
;
...
@@ -284,31 +286,31 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
...
@@ -284,31 +286,31 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
if
(
!
sensor
)
if
(
!
sensor
)
continue
;
continue
;
rail
=
kmalloc
(
sizeof
(
*
rail
),
GFP_KERNEL
);
if
(
!
rail
)
return
-
ENOMEM
;
switch
(
sensor
->
type
)
{
switch
(
sensor
->
type
)
{
case
NVBIOS_EXTDEV_INA209
:
case
NVBIOS_EXTDEV_INA209
:
if
(
r
->
rail
!=
0
)
if
(
r
->
rail
!=
0
)
continue
;
continue
;
r
ail
->
r
ead
=
nvkm_iccsense_ina209_read
;
read
=
nvkm_iccsense_ina209_read
;
break
;
break
;
case
NVBIOS_EXTDEV_INA219
:
case
NVBIOS_EXTDEV_INA219
:
if
(
r
->
rail
!=
0
)
if
(
r
->
rail
!=
0
)
continue
;
continue
;
r
ail
->
r
ead
=
nvkm_iccsense_ina219_read
;
read
=
nvkm_iccsense_ina219_read
;
break
;
break
;
case
NVBIOS_EXTDEV_INA3221
:
case
NVBIOS_EXTDEV_INA3221
:
if
(
r
->
rail
>=
3
)
if
(
r
->
rail
>=
3
)
continue
;
continue
;
r
ail
->
r
ead
=
nvkm_iccsense_ina3221_read
;
read
=
nvkm_iccsense_ina3221_read
;
break
;
break
;
default:
default:
continue
;
continue
;
}
}
rail
=
kmalloc
(
sizeof
(
*
rail
),
GFP_KERNEL
);
if
(
!
rail
)
return
-
ENOMEM
;
sensor
->
rail_mask
|=
1
<<
r
->
rail
;
sensor
->
rail_mask
|=
1
<<
r
->
rail
;
rail
->
read
=
read
;
rail
->
sensor
=
sensor
;
rail
->
sensor
=
sensor
;
rail
->
idx
=
r
->
rail
;
rail
->
idx
=
r
->
rail
;
rail
->
mohm
=
r
->
resistor_mohm
;
rail
->
mohm
=
r
->
resistor_mohm
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment