Skip to content

Commit 6e22e3d

Browse files
pelwellpopcornmix
authored andcommitted
misc: rp1-pio: Handle probe errors
Ensure that rp1_pio_open fails if the device failed to probe. Link: #6593 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent 806fbd2 commit 6e22e3d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/misc/rp1-pio.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,9 @@ struct rp1_pio_client *rp1_pio_open(void)
10141014
{
10151015
struct rp1_pio_client *client;
10161016

1017+
if (!g_pio)
1018+
return ERR_PTR(-ENOENT);
1019+
10171020
client = kzalloc(sizeof(*client), GFP_KERNEL);
10181021
if (!client)
10191022
return ERR_PTR(-ENOMEM);
@@ -1265,9 +1268,8 @@ static int rp1_pio_probe(struct platform_device *pdev)
12651268
return dev_err_probe(dev, pdev->id, "alias is missing\n");
12661269

12671270
fw = devm_rp1_firmware_get(dev, dev->of_node);
1268-
if (IS_ERR(fw))
1269-
return PTR_ERR(fw);
1270-
1271+
if (IS_ERR_OR_NULL(fw))
1272+
return dev_err_probe(dev, -ENOENT, "failed to contact RP1 firmware\n");
12711273
ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count);
12721274
if (ret < 0)
12731275
return ret;

0 commit comments

Comments
 (0)