Merge tag 'apple-soc-drivers-6.19' of https://git.kernel.org/pub/scm/linux/kernel/git/sven/linux into soc/drivers-late
Apple SoC driver updates for 6.18 Two small fixes: - mailbox: Stop leaking a reference to the mbox platform device during lookup - sart: drop device reference after lookup since it's no longer used afterwards Signed-off-by: Sven Peter <sven@kernel.org> * tag 'apple-soc-drivers-6.19' of https://git.kernel.org/pub/scm/linux/kernel/git/sven/linux: soc: apple: sart: drop device reference after lookup soc: apple: mailbox: fix device leak on lookup Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
@@ -302,11 +302,18 @@ struct apple_mbox *apple_mbox_get(struct device *dev, int index)
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
|
||||
mbox = platform_get_drvdata(pdev);
|
||||
if (!mbox)
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
if (!mbox) {
|
||||
mbox = ERR_PTR(-EPROBE_DEFER);
|
||||
goto out_put_pdev;
|
||||
}
|
||||
|
||||
if (!device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_CONSUMER))
|
||||
return ERR_PTR(-ENODEV);
|
||||
if (!device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_CONSUMER)) {
|
||||
mbox = ERR_PTR(-ENODEV);
|
||||
goto out_put_pdev;
|
||||
}
|
||||
|
||||
out_put_pdev:
|
||||
put_device(&pdev->dev);
|
||||
|
||||
return mbox;
|
||||
}
|
||||
|
||||
@@ -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