Skip to content

Commit

Permalink
usb: typec: intel_pmc_mux: Put fwnode in error case during ->probe()
Browse files Browse the repository at this point in the history
commit 1a85b35 upstream.

device_get_next_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

Fixes: 6701adf ("usb: typec: driver for Intel PMC mux control")
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210607205007.71458-1-andy.shevchenko@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
andy-shev authored and gregkh committed Jun 16, 2021
1 parent 572de10 commit 6900ef1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/typec/mux/intel_pmc_mux.c
Expand Up @@ -623,8 +623,10 @@ static int pmc_usb_probe(struct platform_device *pdev)
break;

ret = pmc_usb_register_port(pmc, i, fwnode);
if (ret)
if (ret) {
fwnode_handle_put(fwnode);
goto err_remove_ports;
}
}

platform_set_drvdata(pdev, pmc);
Expand Down

0 comments on commit 6900ef1

Please sign in to comment.