Skip to content

Commit d5318d3

Browse files
jhovoldLee Jones
authored andcommitted
backlight: as3711_bl: Fix Device Tree node leaks
Two framebuffer device-node names were looked up during probe, but were only used as flags to indicate the presence of two framebuffer device. Drop the unused framebuffer name along with a likewise unused device pointer from the driver data, and update the platform data to pass in booleans instead of the framebuffer strings. This allows us do drop the node references acquired during probe, which would otherwise leak. Note that there are no other in-kernel users of the modified platform-data fields. Fixes: 59eb2b5 ("drivers/video/backlight/as3711_bl.c: add OF support") Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 2b12dfa commit d5318d3

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎drivers/video/backlight/as3711_bl.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ enum as3711_bl_type {
2828

2929
struct as3711_bl_data {
3030
bool powered;
31-
const char *fb_name;
32-
struct device *fb_dev;
3331
enum as3711_bl_type type;
3432
int brightness;
3533
struct backlight_device *bl;
@@ -273,7 +271,9 @@ static int as3711_backlight_parse_dt(struct device *dev)
273271

274272
fb = of_parse_phandle(bl, "su1-dev", 0);
275273
if (fb) {
276-
pdata->su1_fb = fb->full_name;
274+
of_node_put(fb);
275+
276+
pdata->su1_fb = true;
277277

278278
ret = of_property_read_u32(bl, "su1-max-uA", &pdata->su1_max_uA);
279279
if (pdata->su1_max_uA <= 0)
@@ -286,7 +286,9 @@ static int as3711_backlight_parse_dt(struct device *dev)
286286
if (fb) {
287287
int count = 0;
288288

289-
pdata->su2_fb = fb->full_name;
289+
of_node_put(fb);
290+
291+
pdata->su2_fb = true;
290292

291293
ret = of_property_read_u32(bl, "su2-max-uA", &pdata->su2_max_uA);
292294
if (pdata->su2_max_uA <= 0)
@@ -425,7 +427,6 @@ static int as3711_backlight_probe(struct platform_device *pdev)
425427

426428
if (pdata->su1_fb) {
427429
su = &supply->su1;
428-
su->fb_name = pdata->su1_fb;
429430
su->type = AS3711_BL_SU1;
430431

431432
max_brightness = min(pdata->su1_max_uA, 31);
@@ -436,7 +437,6 @@ static int as3711_backlight_probe(struct platform_device *pdev)
436437

437438
if (pdata->su2_fb) {
438439
su = &supply->su2;
439-
su->fb_name = pdata->su2_fb;
440440
su->type = AS3711_BL_SU2;
441441

442442
switch (pdata->su2_fbprot) {

‎include/linux/mfd/as3711.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ struct as3711_regulator_pdata {
108108
};
109109

110110
struct as3711_bl_pdata {
111-
const char *su1_fb;
111+
bool su1_fb;
112112
int su1_max_uA;
113-
const char *su2_fb;
113+
bool su2_fb;
114114
int su2_max_uA;
115115
enum as3711_su2_feedback su2_feedback;
116116
enum as3711_su2_fbprot su2_fbprot;

0 commit comments

Comments
 (0)