Alan, can you revisit a patch you authored please?
Hi Alan,
I'm looking at a patch you wrote which can be foudn below at [1]. Are you sure it's correct to ignore i.e not return -ENOMEM from platform_device_add_data() in pcf50633_probe()? I believe if platform_device_add_data() returns an error we should platform_device_put() and return immediately. Can you tell me if you agree. If you don't, would you mind explaining to me why please?
Kind regards,
Lee
[1]
commit 18273c5b463d9f98ef81f1a6217a7f4168dd809a
Author: Alan Cox <[email protected]> Date: Fri Jul 13 16:43:32 2012 +0100
mfd: Add missing out of memory check for pcf50633
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44561
drivers/mfd/pcf50633-core.c +7 -2
@@ -253,8 +253,13 @@ static int __devinit pcf50633_probe(struct i2c_client *client, } pdev->dev.parent = pcf->dev; -platform_device_add_data (pdev, &pdata->reg_init_data[i], -sizeof (pdata->reg_init_data[i])); +if (platform_device_add_data (pdev, &pdata->reg_init_data[i], +sizeof (pdata->reg_init_data[i])) <0 ) { +platform_device_put (pdev); +dev_err (pcf->dev,"Out of memory for regulator parameters %d\n" , + i); +continue ; + } pcf->regulator_pdev[i] = pdev;platform_device_add (pdev);
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 8 lines · On Mon, 23 Jun 2014 09:53:45 +0100 Lee Jones <[email protected]> wrote:
Hi Alan,
I'm looking at a patch you wrote which can be foudn below at [1]. Are you sure it's correct to ignore i.e not return
-ENOMEMfromplatform_device_add_data()inpcf50633_probe()? I believe ifplatform_device_add_data()returns an error we shouldplatform_device_put()and return immediately. Can you tell me if you agree. If you don't, would you mind explaining to me why please?
I made the change to maximise the chance of things booting up ok, but I agree, its a pointless exercise. If we fail to add the data we should just chuck it.
Alan
Quoted 12 lines · One Thousand Gnomes
Quoted 8 lines · On Mon, 23 Jun 2014 09:53:45 +0100 Lee Jones <[email protected]> wrote:
Hi Alan,
I'm looking at a patch you wrote which can be foudn below at [1]. Are you sure it's correct to ignore i.e not return
-ENOMEMfromplatform_device_add_data()inpcf50633_probe()? I believe ifplatform_device_add_data()returns an error we shouldplatform_device_put()and return immediately. Can you tell me if you agree. If you don't, would you mind explaining to me why please?
Quoted 3 lines
I made the change to maximise the chance of things booting up ok, but I agree, its a pointless exercise. If we fail to add the data we should just chuck it.
Thanks Alan, I'll get a patch out shortly.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog