Skip to content

Commit

Permalink
backlight: sky81452-backlight: Remove unnecessary call to of_node_get()
Browse files Browse the repository at this point in the history
`dev->of_node` already has a reference to the device_node and calling
of_node_get on it is unnecessary. All conresponding calls to
of_node_put are also removed.

Signed-off-by: Shresth Prasad <shresthprasad7@gmail.com>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://lore.kernel.org/r/20240502172121.8695-2-shresthprasad7@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
  • Loading branch information
Shresth Prasad authored and Lee Jones committed May 10, 2024
1 parent f80460c commit 1fd949f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/video/backlight/sky81452-backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static const struct attribute_group sky81452_bl_attr_group = {
static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
struct device *dev)
{
struct device_node *np = of_node_get(dev->of_node);
struct device_node *np = dev->of_node;
struct sky81452_bl_platform_data *pdata;
int num_entry;
unsigned int sources[6];
Expand All @@ -194,10 +194,8 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
}

pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
of_node_put(np);
if (!pdata)
return ERR_PTR(-ENOMEM);
}

of_property_read_string(np, "name", &pdata->name);
pdata->ignore_pwm = of_property_read_bool(np, "skyworks,ignore-pwm");
Expand All @@ -217,7 +215,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
num_entry);
if (ret < 0) {
dev_err(dev, "led-sources node is invalid.\n");
of_node_put(np);
return ERR_PTR(-EINVAL);
}

Expand All @@ -237,7 +234,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
if (ret < 0)
pdata->boost_current_limit = 2750;

of_node_put(np);
return pdata;
}
#else
Expand Down

0 comments on commit 1fd949f

Please sign in to comment.