diff mbox

[v8,5/9] i2c: mux: pca954x: Return error if irq_create_mapping fails

Message ID 1500365984-61404-6-git-send-email-preid@electromag.com.au (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Phil Reid July 18, 2017, 8:19 a.m. UTC
irq_create_mapping can return an error, report error to log and return.
Cleanup will occur inprobe function when an error is returned.

Suggested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Phil Reid <preid@electromag.com.au>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Peter Rosin July 18, 2017, 8:41 p.m. UTC | #1
Really minor nits, don't respin over this, but if you do respin over
something else, please fix these as well.

On 2017-07-18 10:19, Phil Reid wrote:
> irq_create_mapping can return an error, report error to log and return.
> Cleanup will occur inprobe function when an error is returned.

s/inprobe/in the probe/

> 
> Suggested-by: Peter Rosin <peda@axentia.se>
> Signed-off-by: Phil Reid <preid@electromag.com.au>
> ---
>  drivers/i2c/muxes/i2c-mux-pca954x.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
> index 9867720..0594775 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> @@ -309,6 +309,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 <= 0) {

irq_create_mapping returns an unsigned int, so I'd write that as

		if (!irq) {

Either way,

Acked-by: Peter Rosin <peda@axentia.se>

Cheers,
Peter

> +			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);
>
diff mbox

Patch

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 9867720..0594775 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -309,6 +309,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 <= 0) {
+			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);