Re: [PATCH v3 03/34] component: Introduce the aggregate bus_type
From: Stephen Boyd
Date: Tue Oct 26 2021 - 15:33:12 EST
Quoting kernel test robot (2021-10-26 07:02:03)
>
> drivers/base/component.c: In function '__component_add':
> >> drivers/base/component.c:858:13: error: variable 'ret' set but not used [-Werror=unused-but-set-variable]
> 858 | int ret;
> | ^~~
> cc1: all warnings being treated as errors
>
>
> vim +/ret +858 drivers/base/component.c
>
> 2a41e6070dd7ef Russell King 2014-01-10 853
> 3521ee994bca90 Daniel Vetter 2019-02-08 854 static int __component_add(struct device *dev, const struct component_ops *ops,
> 3521ee994bca90 Daniel Vetter 2019-02-08 855 int subcomponent)
> 2a41e6070dd7ef Russell King 2014-01-10 856 {
> 2a41e6070dd7ef Russell King 2014-01-10 857 struct component *component;
> 2a41e6070dd7ef Russell King 2014-01-10 @858 int ret;
> 2a41e6070dd7ef Russell King 2014-01-10 859
> 2a41e6070dd7ef Russell King 2014-01-10 860 component = kzalloc(sizeof(*component), GFP_KERNEL);
> 2a41e6070dd7ef Russell King 2014-01-10 861 if (!component)
> 2a41e6070dd7ef Russell King 2014-01-10 862 return -ENOMEM;
> 2a41e6070dd7ef Russell King 2014-01-10 863
> 2a41e6070dd7ef Russell King 2014-01-10 864 component->ops = ops;
> 2a41e6070dd7ef Russell King 2014-01-10 865 component->dev = dev;
> 3521ee994bca90 Daniel Vetter 2019-02-08 866 component->subcomponent = subcomponent;
> 2a41e6070dd7ef Russell King 2014-01-10 867
> 2a41e6070dd7ef Russell King 2014-01-10 868 dev_dbg(dev, "adding component (ops %ps)\n", ops);
> 2a41e6070dd7ef Russell King 2014-01-10 869
> 2a41e6070dd7ef Russell King 2014-01-10 870 mutex_lock(&component_mutex);
> 2a41e6070dd7ef Russell King 2014-01-10 871 list_add_tail(&component->node, &component_list);
> 2a41e6070dd7ef Russell King 2014-01-10 872 mutex_unlock(&component_mutex);
> 2a41e6070dd7ef Russell King 2014-01-10 873
> 748369f5c5e62a Stephen Boyd 2021-10-25 874 /*
> 748369f5c5e62a Stephen Boyd 2021-10-25 875 * Try to bind.
> 748369f5c5e62a Stephen Boyd 2021-10-25 876 *
> 748369f5c5e62a Stephen Boyd 2021-10-25 877 * Note: we don't check the return value here because component devices
> 748369f5c5e62a Stephen Boyd 2021-10-25 878 * don't care that the aggregate device can actually probe or not. They
> 748369f5c5e62a Stephen Boyd 2021-10-25 879 * only care about adding themselves to the component_list and then
> 748369f5c5e62a Stephen Boyd 2021-10-25 880 * waiting for their component_ops::bind_component callback to be
> 748369f5c5e62a Stephen Boyd 2021-10-25 881 * called.
> 748369f5c5e62a Stephen Boyd 2021-10-25 882 */
> 748369f5c5e62a Stephen Boyd 2021-10-25 883 ret = bus_rescan_devices(&aggregate_bus_type);
Ok I guess I have to print a dev_dbg() as well to silence this.