openwrt-cghmn-mt300n/target/linux/bcm27xx/patches-6.6/950-1509-misc-rp1-pio-Handle-probe-errors.patch
Álvaro Fernández Rojas 251f76c1c6 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>
2025-03-16 08:04:48 +01:00

39 lines
1.2 KiB
Diff

From e56aa0bd2b552daa4349a7eb2e6b0dec81d3e5cc Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 9 Jan 2025 16:40:25 +0000
Subject: [PATCH] misc: rp1-pio: Handle probe errors
Ensure that rp1_pio_open fails if the device failed to probe.
Link: https://github.com/raspberrypi/linux/issues/6593
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/misc/rp1-pio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/drivers/misc/rp1-pio.c
+++ b/drivers/misc/rp1-pio.c
@@ -1014,6 +1014,9 @@ struct rp1_pio_client *rp1_pio_open(void
{
struct rp1_pio_client *client;
+ if (!g_pio)
+ return ERR_PTR(-ENOENT);
+
client = kzalloc(sizeof(*client), GFP_KERNEL);
if (!client)
return ERR_PTR(-ENOMEM);
@@ -1265,9 +1268,8 @@ 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(fw))
- return PTR_ERR(fw);
-
+ if (IS_ERR_OR_NULL(fw))
+ return dev_err_probe(dev, -ENOENT, "failed to contact RP1 firmware\n");
ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count);
if (ret < 0)
return ret;