Skip to content

Commit 992cb95

Browse files
committed
fixup! media: apple: isp: Working t602x and multiple formats and more fixes
Use for_each_child_of_node_scoped() for scope based cleanup of child device_node. Removes surprising but documented of_node_put() on error in isp_of_read_coord(). Reported-by: kernel test robot <[email protected]> Reported-by: Julia Lawall <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Janne Grunau <[email protected]>
1 parent 68a933d commit 992cb95

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/media/platform/apple/isp/isp-drv.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ static void apple_isp_free_iommu(struct apple_isp *isp)
138138
drm_mm_takedown(&isp->iovad);
139139
}
140140

141-
/* NOTE: of_node_put()s the OF node on failure. */
142141
static int isp_of_read_coord(struct device *dev, struct device_node *np,
143142
const char *prop, struct coord *val)
144143
{
@@ -148,7 +147,6 @@ static int isp_of_read_coord(struct device *dev, struct device_node *np,
148147
ret = of_property_read_u32_array(np, prop, xy, 2);
149148
if (ret) {
150149
dev_err(dev, "failed to read '%s' property\n", prop);
151-
of_node_put(np);
152150
return ret;
153151
}
154152

@@ -160,7 +158,6 @@ static int isp_of_read_coord(struct device *dev, struct device_node *np,
160158
static int apple_isp_init_presets(struct apple_isp *isp)
161159
{
162160
struct device *dev = isp->dev;
163-
struct device_node *child;
164161
struct isp_preset *preset;
165162
int err = 0;
166163

@@ -183,14 +180,13 @@ static int apple_isp_init_presets(struct apple_isp *isp)
183180
return -ENOMEM;
184181

185182
preset = isp->presets;
186-
for_each_child_of_node(np, child) {
183+
for_each_child_of_node_scoped(np, child) {
187184
u32 xywh[4];
188185

189186
err = of_property_read_u32(child, "apple,config-index",
190187
&preset->index);
191188
if (err) {
192189
dev_err(dev, "no apple,config-index property\n");
193-
of_node_put(child);
194190
return err;
195191
}
196192

@@ -206,7 +202,6 @@ static int apple_isp_init_presets(struct apple_isp *isp)
206202
err = of_property_read_u32_array(child, "apple,crop", xywh, 4);
207203
if (err) {
208204
dev_err(dev, "failed to read 'apple,crop' property\n");
209-
of_node_put(child);
210205
return err;
211206
}
212207
preset->crop_offset.x = xywh[0];

0 commit comments

Comments
 (0)