[PATCH] nvme: Add error path for xa_store in nvme_init_effects

Keisuke Nishimura keisuke.nishimura at inria.fr
Mon Dec 16 07:32:08 PST 2024



On 12/12/2024 07:28, Christoph Hellwig wrote:
> On Mon, Dec 02, 2024 at 04:39:22PM +0100, Keisuke Nishimura wrote:
>>   	if (!ctrl->effects) {
>> +		struct nvme_effects_log *effects, *old;
>> +
>> +		effects = kzalloc(sizeof(*effects), GFP_KERNEL);
>> +		if (effects)
>>   			return -ENOMEM;
>> +
>> +		old = xa_store(&ctrl->cels, NVME_CSI_NVM, effects, GFP_KERNEL);
>> +		if (xa_is_err(old)) {
>> +			kfree(effects);
>> +			return xa_err(old);
>> +		}
>> +		ctrl->effects = effects;
> 
> Please split this into a helper now that is becoming rather complex.
> 
> Otherwise this looks fine to me.

Thank you for the review. I will send the new version soon.

Keisuke



More information about the Linux-nvme mailing list