]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
i2c: mux: pca954x: Return error if irq_create_mapping fails
authorPhil Reid <preid@electromag.com.au>
Thu, 24 Aug 2017 09:31:06 +0000 (17:31 +0800)
committerWolfram Sang <wsa@the-dreams.de>
Sat, 28 Oct 2017 21:43:10 +0000 (23:43 +0200)
irq_create_mapping can return an error, report error to log and return.
Cleanup will occur in the probe function when an error is returned.

Suggested-by: Peter Rosin <peda@axentia.se>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/muxes/i2c-mux-pca954x.c

index 14aee65298f757b516519e9e8563eabb0d6dd9b7..2ca068d8b92d23f0423b7a0c7f12ee6150c759ec 100644 (file)
@@ -277,6 +277,10 @@ static int pca954x_irq_setup(struct i2c_mux_core *muxc)
 
        for (c = 0; c < data->chip->nchans; c++) {
                irq = irq_create_mapping(data->irq, c);
+               if (!irq) {
+                       dev_err(&client->dev, "failed irq create map\n");
+                       return -EINVAL;
+               }
                irq_set_chip_data(irq, data);
                irq_set_chip_and_handler(irq, &pca954x_irq_chip,
                        handle_simple_irq);