mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
Bluetooth: hci_intel: Fix null gpio desc pointer dereference
commit32b9ccbc35upstream. gpiod_get_optional can return either ERR_PTR or NULL pointer. NULL case is not tested and then dereferenced later in desc_to_gpio. Fix this by using non optional version which returns ERR_PTR in any error case (this is not an optional gpio). Use the same non optional version for the host-wake gpio. Fixes:765ea3abd1("Bluetooth: hci_intel: Retrieve host-wake IRQ") Signed-off-by: Loic Poulain <loic.poulain@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -1234,8 +1234,7 @@ static int intel_probe(struct platform_device *pdev)
|
||||
|
||||
idev->pdev = pdev;
|
||||
|
||||
idev->reset = devm_gpiod_get_optional(&pdev->dev, "reset",
|
||||
GPIOD_OUT_LOW);
|
||||
idev->reset = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(idev->reset)) {
|
||||
dev_err(&pdev->dev, "Unable to retrieve gpio\n");
|
||||
return PTR_ERR(idev->reset);
|
||||
@@ -1247,8 +1246,7 @@ static int intel_probe(struct platform_device *pdev)
|
||||
|
||||
dev_err(&pdev->dev, "No IRQ, falling back to gpio-irq\n");
|
||||
|
||||
host_wake = devm_gpiod_get_optional(&pdev->dev, "host-wake",
|
||||
GPIOD_IN);
|
||||
host_wake = devm_gpiod_get(&pdev->dev, "host-wake", GPIOD_IN);
|
||||
if (IS_ERR(host_wake)) {
|
||||
dev_err(&pdev->dev, "Unable to retrieve IRQ\n");
|
||||
goto no_irq;
|
||||
|
||||
Reference in New Issue
Block a user