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
nexedi
linux
Commits
e430dc00
Commit
e430dc00
authored
Jul 04, 2012
by
Bryan Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
leds: convert LP5521 LED driver to devm_kzalloc() and cleanup error exit path
Signed-off-by:
Bryan Wu
<
bryan.wu@canonical.com
>
parent
bad1c898
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
drivers/leds/leds-lp5521.c
drivers/leds/leds-lp5521.c
+8
-12
No files found.
drivers/leds/leds-lp5521.c
View file @
e430dc00
...
...
@@ -744,7 +744,7 @@ static int __devinit lp5521_probe(struct i2c_client *client,
int
ret
,
i
,
led
;
u8
buf
;
chip
=
kzalloc
(
sizeof
(
*
chip
),
GFP_KERNEL
);
chip
=
devm_kzalloc
(
&
client
->
dev
,
sizeof
(
*
chip
),
GFP_KERNEL
);
if
(
!
chip
)
return
-
ENOMEM
;
...
...
@@ -755,8 +755,7 @@ static int __devinit lp5521_probe(struct i2c_client *client,
if
(
!
pdata
)
{
dev_err
(
&
client
->
dev
,
"no platform data
\n
"
);
ret
=
-
EINVAL
;
goto
fail1
;
return
-
EINVAL
;
}
mutex_init
(
&
chip
->
lock
);
...
...
@@ -766,7 +765,7 @@ static int __devinit lp5521_probe(struct i2c_client *client,
if
(
pdata
->
setup_resources
)
{
ret
=
pdata
->
setup_resources
();
if
(
ret
<
0
)
goto
fail1
;
return
ret
;
}
if
(
pdata
->
enable
)
{
...
...
@@ -807,7 +806,7 @@ static int __devinit lp5521_probe(struct i2c_client *client,
ret
=
lp5521_configure
(
client
);
if
(
ret
<
0
)
{
dev_err
(
&
client
->
dev
,
"error configuring chip
\n
"
);
goto
fail
2
;
goto
fail
1
;
}
/* Initialize leds */
...
...
@@ -822,7 +821,7 @@ static int __devinit lp5521_probe(struct i2c_client *client,
ret
=
lp5521_init_led
(
&
chip
->
leds
[
led
],
client
,
i
,
pdata
);
if
(
ret
)
{
dev_err
(
&
client
->
dev
,
"error initializing leds
\n
"
);
goto
fail
3
;
goto
fail
2
;
}
chip
->
num_leds
++
;
...
...
@@ -840,21 +839,19 @@ static int __devinit lp5521_probe(struct i2c_client *client,
ret
=
lp5521_register_sysfs
(
client
);
if
(
ret
)
{
dev_err
(
&
client
->
dev
,
"registering sysfs failed
\n
"
);
goto
fail
3
;
goto
fail
2
;
}
return
ret
;
fail
3
:
fail
2
:
for
(
i
=
0
;
i
<
chip
->
num_leds
;
i
++
)
{
led_classdev_unregister
(
&
chip
->
leds
[
i
].
cdev
);
cancel_work_sync
(
&
chip
->
leds
[
i
].
brightness_work
);
}
fail
2
:
fail
1
:
if
(
pdata
->
enable
)
pdata
->
enable
(
0
);
if
(
pdata
->
release_resources
)
pdata
->
release_resources
();
fail1:
kfree
(
chip
);
return
ret
;
}
...
...
@@ -875,7 +872,6 @@ static int __devexit lp5521_remove(struct i2c_client *client)
chip
->
pdata
->
enable
(
0
);
if
(
chip
->
pdata
->
release_resources
)
chip
->
pdata
->
release_resources
();
kfree
(
chip
);
return
0
;
}
...
...
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