Re: [PATCH v3 2/6] iio: light: Add gain-time-scale helpers

From: Matti Vaittinen
Date: Mon Mar 13 2023 - 10:26:01 EST


On 3/13/23 16:17, Andy Shevchenko wrote:
On Mon, Mar 13, 2023 at 03:59:03PM +0200, Matti Vaittinen wrote:
On 3/13/23 15:25, Andy Shevchenko wrote:
On Mon, Mar 13, 2023 at 02:47:45PM +0200, Matti Vaittinen wrote:
On 3/6/23 14:52, Andy Shevchenko wrote:
On Mon, Mar 06, 2023 at 11:17:15AM +0200, Matti Vaittinen wrote:

...

+ if (ret && gts->avail_all_scales_table)

In one case you commented that free(NULL) is okay, in the other, you add
a duplicative check. Why?

Sorry but what do you mean by dublicative check?

Usually I avoid the kfree(NULL). That's why I commented on it in that
another case where it was not explicitly disallowed. I'll change that for v4
to avoid kfree(NULL) as you suggested.

So, and with it you put now a double check for NULL, do you think it's okay?
I don't.

I don't see the double check. I see only one check just above the kfree()?
Where is the other check?

if (... gts->avail_all_scales_table)

is a double to one, which is inside kfree(). I.o.w. kfree() is NULL-aware
and you know that.

Ah. I thought you suggested I had double check in the code I wrote. Now I see what you meant.

Yes, I think that check should be dropped.

-- Matti

--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~