Re: [PATCH v3 2/2] leds: Add PWM multicolor driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Skipping mutex destruction is not critical, but in general if you wish to free allocated resource, it should be done in reversed order...
As far as I can tell, the ordering is already reversed:

mcnode = device_get_named_child_node(&pdev->dev, "multi-led");
/* ... */
mutex_init(&priv->lock);
/* ... */
fwnode_for_each_child_node(mcnode, fwnode) {
    /* ... */
    fwnode_handle_put(fwnode);
    goto destroy_mutex;
    /* ... */
}
/* ... */
destroy_mutex:
    mutex_destroy(&priv->lock);
release_mcnode:
    fwnode_handle_put(mcnode);
out:
    return ret;

            +destroy_mutex:
            +       mutex_destroy(&priv->lock);


        Wrong ordering here and in ->remove().

        Don't mix devm_* with non-devm_* calls.

    What do you mean by this?


...which is exactly the issue with this code because of the use of devm_*() calls mixed with non-devm_*() ones.

TL;DR: ordering is broken here. And to fix it you need either a) to convert all calls to be devm_*(), or b) make them all non-devm, or c) regroup resource allocation so that all devm followed by non-devm ones.Which non-devm calls are you referring to?

Thanks for your patience,
Sven



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux