[PATCH] mtd: rawnand: omap2: fix device leak on probe failure

Miquel Raynal miquel.raynal at bootlin.com
Wed Sep 24 00:43:16 PDT 2025


Hi Markus,

>> @@ -2083,10 +2084,24 @@ static int omap_nand_attach_chip(struct nand_chip *chip)
>>  		dev_err(dev,
>>  			"Not enough OOB bytes: required = %d, available=%d\n",
>>  			min_oobbytes, mtd->oobsize);
>> -		return -EINVAL;
>> +		err = -EINVAL;
>> +		goto err_put_elm_dev;
>>  	}
>>
> May such an error code assignment be moved behind an additional label?

I don't think that's how labels are supposed to be used, current
proposal looks correct IMO.

Thanks,
Miquèl



More information about the linux-mtd mailing list