mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
soc: apple: sart: drop device reference after lookup
Holding a reference to a device does not prevent its driver data from going away so there is no point in keeping the reference after looking up the sart device. Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Sven Peter <sven@kernel.org>
This commit is contained in:
@@ -214,17 +214,11 @@ static int apple_sart_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void apple_sart_put_device(void *dev)
|
||||
{
|
||||
put_device(dev);
|
||||
}
|
||||
|
||||
struct apple_sart *devm_apple_sart_get(struct device *dev)
|
||||
{
|
||||
struct device_node *sart_node;
|
||||
struct platform_device *sart_pdev;
|
||||
struct apple_sart *sart;
|
||||
int ret;
|
||||
|
||||
sart_node = of_parse_phandle(dev->of_node, "apple,sart", 0);
|
||||
if (!sart_node)
|
||||
@@ -242,14 +236,11 @@ struct apple_sart *devm_apple_sart_get(struct device *dev)
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(dev, apple_sart_put_device,
|
||||
&sart_pdev->dev);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
device_link_add(dev, &sart_pdev->dev,
|
||||
DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_SUPPLIER);
|
||||
|
||||
put_device(&sart_pdev->dev);
|
||||
|
||||
return sart;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_apple_sart_get);
|
||||
|
||||
Reference in New Issue
Block a user