Message ID | 20181016072244.1216-1-a.hajda@samsung.com (mailing list archive) |
---|---|
Headers | show |
Series | driver core: add probe error check helper | expand |
Hello Andrzej, On 10/16/2018 09:22 AM, Andrzej Hajda wrote: > The patch replaces obviously matching code with probe_err function. > There are many more places where probe_err could be used. > The patch shows how the new function should be used, and how it > improves the code. > > It was generated by cocci script (little bit dirty): > This is great! I guess the easier would be to split these by kernel releases, maybe patch #1 and #2 can land in one kernel release and then each subsystem can merge the changes for their drivers with the dependency already in place. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Best regards,
On Tue, Oct 16, 2018 at 10:22 AM Andrzej Hajda <a.hajda@samsung.com> wrote: > > The patch replaces obviously matching code with probe_err function. > There are many more places where probe_err could be used. > The patch shows how the new function should be used, and how it > improves the code. > --- a/drivers/gpio/gpio-pca953x.c > +++ b/drivers/gpio/gpio-pca953x.c > @@ -824,9 +824,7 @@ static int pca953x_probe(struct i2c_client *client, > reg = devm_regulator_get(&client->dev, "vcc"); > if (IS_ERR(reg)) { > ret = PTR_ERR(reg); > - if (ret != -EPROBE_DEFER) > - dev_err(&client->dev, "reg get err: %d\n", ret); > - return ret; > + return probe_err(&client->dev, ret, "reg get err: %d\n", ret); No need to assign ret above. As I mentioned, better to print a value for everyone. > } Please, split it at least one patch per subsystem.
On 16.10.2018 15:51, Andy Shevchenko wrote: > On Tue, Oct 16, 2018 at 10:22 AM Andrzej Hajda <a.hajda@samsung.com> wrote: >> The patch replaces obviously matching code with probe_err function. >> There are many more places where probe_err could be used. >> The patch shows how the new function should be used, and how it >> improves the code. >> --- a/drivers/gpio/gpio-pca953x.c >> +++ b/drivers/gpio/gpio-pca953x.c >> @@ -824,9 +824,7 @@ static int pca953x_probe(struct i2c_client *client, >> reg = devm_regulator_get(&client->dev, "vcc"); >> if (IS_ERR(reg)) { >> ret = PTR_ERR(reg); >> - if (ret != -EPROBE_DEFER) >> - dev_err(&client->dev, "reg get err: %d\n", ret); >> - return ret; >> + return probe_err(&client->dev, ret, "reg get err: %d\n", ret); > No need to assign ret above. > As I mentioned, better to print a value for everyone. OK. Thanks for all reviews. I have posted v2 of patches 1 and 2 as replies in this thread. As patch 3 requires splitting, adjusting arguments of probe_err (remove err and newline), and depends on patch 1 I will prepare it and post later, probably next cycle as suggested Javier. Regards Andrzej > >> } > Please, split it at least one patch per subsystem. >