Re: [PATCH v3 05/23] media: iris: Prevent HFI queue writes when core is in deinit state

From: Bryan O'Donoghue
Date: Fri May 02 2025 - 08:22:47 EST


On 01/05/2025 20:13, Dikshita Agarwal wrote:
- if (core->state == IRIS_CORE_ERROR)
+ if (core->state == IRIS_CORE_ERROR || core->state == IRIS_CORE_DEINIT)
return -EINVAL;

Instead of checking for 2/3 of the states why not just check for the 1/3 ?

enum iris_core_state {
IRIS_CORE_DEINIT,
IRIS_CORE_INIT,
IRIS_CORE_ERROR,
};

if (core->state != IRIS_CORE_INIT)
return -EINVAL;

Cleaner and more explicit - declaring the state you must be in, as opposed to a list of states you should not be in.

Assuming you accept that suggested change:

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>