Re: [PATCH] USB: quirks: simplify quirk handling.

From: Kars Mulder
Date: Wed Sep 23 2020 - 12:41:06 EST


On Monday, September 21, 2020 13:30 CEST, Pavel Machek <pavel@xxxxxxx> wrote:
> Simplify quirk handling.

This patch seems to contain two different "simplifications" in one.
I have no objections against the first simplification:

- if (quirk_list) {
- kfree(quirk_list);
- quirk_list = NULL;
- }
-
+ kfree(quirk_list);
quirk_list = kcalloc(quirk_count, sizeof(struct quirk_entry),
GFP_KERNEL);

Since kfree() does nothing to nullpointers, all lines that are cut seem
to be superfluous.

The second simplification does not seem to introduce any new bugs as far
as I can tell. Due to lack of experience, I shall refrain from commenting
on whether or not it simplifies things.