BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mangoh-drivers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
mangoh-drivers
Commits
59b38930
Commit
59b38930
authored
Feb 14, 2018
by
David Frey
Committed by
David Clark
Feb 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check for LED driver platform data != NULL
parent
23033fa8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
led.c
linux_kernel_modules/led/led.c
+12
-4
No files found.
linux_kernel_modules/led/led.c
View file @
59b38930
...
@@ -38,20 +38,26 @@ static DEVICE_ATTR_RW(led);
...
@@ -38,20 +38,26 @@ static DEVICE_ATTR_RW(led);
static
int
led_probe
(
struct
platform_device
*
pdev
)
static
int
led_probe
(
struct
platform_device
*
pdev
)
{
{
struct
led_platform_data
*
pdata
=
dev_get_platdata
(
&
pdev
->
dev
);
struct
led_device
*
dev
;
struct
led_device
*
dev
;
int
ret
=
0
;
int
ret
=
0
;
struct
led_platform_data
*
pdata
=
dev_get_platdata
(
&
pdev
->
dev
);
dev_info
(
&
pdev
->
dev
,
"%s(): probe
\n
"
,
__func__
);
dev_info
(
&
pdev
->
dev
,
"%s(): probe
\n
"
,
__func__
);
dev
=
kzalloc
(
sizeof
(
struct
led_device
),
GFP_KERNEL
);
if
(
!
pdata
)
{
ret
=
-
EINVAL
;
dev_err
(
*
pdev
->
dev
,
"Required platform data not provided
\n
"
);
goto
err_no_free
;
}
dev
=
kzalloc
(
sizeof
(
*
dev
),
GFP_KERNEL
);
if
(
!
dev
)
if
(
!
dev
)
goto
err_out
;
goto
err_out
;
dev
->
pdev
=
pdev
;
dev
->
pdev
=
pdev
;
atomic_set
(
&
dev
->
val
,
0
);
atomic_set
(
&
dev
->
val
,
0
);
pdata
=
dev_get_platdata
(
&
pdev
->
dev
);
dev
->
gpio
=
pdata
->
gpio
;
dev
->
gpio
=
pdata
->
gpio
;
ret
=
gpio_request
(
dev
->
gpio
,
dev_name
(
&
pdev
->
dev
));
ret
=
gpio_request
(
dev
->
gpio
,
dev_name
(
&
pdev
->
dev
));
...
@@ -73,7 +79,7 @@ static int led_probe(struct platform_device *pdev)
...
@@ -73,7 +79,7 @@ static int led_probe(struct platform_device *pdev)
}
}
platform_set_drvdata
(
pdev
,
dev
);
platform_set_drvdata
(
pdev
,
dev
);
return
0
;
return
ret
;
free_gpio:
free_gpio:
gpio_direction_input
(
dev
->
gpio
);
gpio_direction_input
(
dev
->
gpio
);
...
@@ -83,6 +89,8 @@ err_out:
...
@@ -83,6 +89,8 @@ err_out:
if
(
dev
)
if
(
dev
)
kfree
(
dev
);
kfree
(
dev
);
err_no_free:
return
ret
;
return
ret
;
}
}
...
...
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