lede/target/linux/bcm27xx/patches-6.12/950-0747-misc-rp1-pio-Handle-probe-errors.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

39 lines
1.2 KiB
Diff

From 7e703a35a9e3153b5d26a8fa84e215d5444c8abf 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;