diff options
Diffstat (limited to 'drivers/mux/core.c')
-rw-r--r-- | drivers/mux/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mux/core.c b/drivers/mux/core.c index 2260063b0ea8..6e5cf9d9cd99 100644 --- a/drivers/mux/core.c +++ b/drivers/mux/core.c | |||
@@ -413,6 +413,7 @@ static int of_dev_node_match(struct device *dev, const void *data) | |||
413 | return dev->of_node == data; | 413 | return dev->of_node == data; |
414 | } | 414 | } |
415 | 415 | ||
416 | /* Note this function returns a reference to the mux_chip dev. */ | ||
416 | static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np) | 417 | static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np) |
417 | { | 418 | { |
418 | struct device *dev; | 419 | struct device *dev; |
@@ -466,6 +467,7 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name) | |||
466 | (!args.args_count && (mux_chip->controllers > 1))) { | 467 | (!args.args_count && (mux_chip->controllers > 1))) { |
467 | dev_err(dev, "%pOF: wrong #mux-control-cells for %pOF\n", | 468 | dev_err(dev, "%pOF: wrong #mux-control-cells for %pOF\n", |
468 | np, args.np); | 469 | np, args.np); |
470 | put_device(&mux_chip->dev); | ||
469 | return ERR_PTR(-EINVAL); | 471 | return ERR_PTR(-EINVAL); |
470 | } | 472 | } |
471 | 473 | ||
@@ -476,10 +478,10 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name) | |||
476 | if (controller >= mux_chip->controllers) { | 478 | if (controller >= mux_chip->controllers) { |
477 | dev_err(dev, "%pOF: bad mux controller %u specified in %pOF\n", | 479 | dev_err(dev, "%pOF: bad mux controller %u specified in %pOF\n", |
478 | np, controller, args.np); | 480 | np, controller, args.np); |
481 | put_device(&mux_chip->dev); | ||
479 | return ERR_PTR(-EINVAL); | 482 | return ERR_PTR(-EINVAL); |
480 | } | 483 | } |
481 | 484 | ||
482 | get_device(&mux_chip->dev); | ||
483 | return &mux_chip->mux[controller]; | 485 | return &mux_chip->mux[controller]; |
484 | } | 486 | } |
485 | EXPORT_SYMBOL_GPL(mux_control_get); | 487 | EXPORT_SYMBOL_GPL(mux_control_get); |