immortalwrt/target/linux/bcm27xx/patches-6.6/950-1531-misc-rp1-pio-Error-out-on-incompatible-firmware.patch
Álvaro Fernández Rojas 5872633b9d bcm27xx: pull 6.6 patches from RPi repo
Adds latest 6.6 patches from the Raspberry Pi repository.

These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.6.y/
With the following command:
git format-patch -N v6.6.83..HEAD
(HEAD -> 08d4e8f52256bd422d8a1f876411603f627d0a82)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry picked from commit 251f76c1c67d62c585d799c38dab31e1385d2ad5)
2025-03-16 21:08:29 +01:00

43 lines
1.4 KiB
Diff

From e0a21a407b78477aa530800255d53405950cb1fb Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 3 Feb 2025 14:44:08 +0000
Subject: [PATCH] misc: rp1-pio: Error out on incompatible firmware
If the RP1 firmware has reported an error then return that from the PIO
probe function, otherwise defer the probing.
Link: https://github.com/raspberrypi/linux/issues/6642
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/misc/rp1-pio.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -1277,8 +1277,10 @@ static int rp1_pio_probe(struct platform
return dev_err_probe(dev, pdev->id, "alias is missing\n");
fw = devm_rp1_firmware_get(dev, dev->of_node);
- if (IS_ERR_OR_NULL(fw))
- return dev_err_probe(dev, -ENOENT, "failed to contact RP1 firmware\n");
+ if (!fw)
+ return dev_err_probe(dev, -EPROBE_DEFER, "failed to find RP1 firmware driver\n");
+ if (IS_ERR(fw))
+ return dev_err_probe(dev, PTR_ERR(fw), "failed to contact RP1 firmware\n");
ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count);
if (ret < 0)
return ret;
@@ -1355,6 +1357,11 @@ static void rp1_pio_remove(struct platfo
if (g_pio == pio)
g_pio = NULL;
+
+ device_destroy(pio->dev_class, pio->dev_num);
+ cdev_del(&pio->cdev);
+ class_destroy(pio->dev_class);
+ unregister_chrdev_region(pio->dev_num, 1);
}
static const struct of_device_id rp1_pio_ids[] = {