Message ID | 20230515175042.495377-2-afd@ti.com |
---|---|
State | New |
Headers | show |
Series | [v2,1/2] i2c: davinci: Use platform table macro over module_alias | expand |
On Mon, May 15, 2023 at 7:50 PM Andrew Davis <afd@ti.com> wrote: > > This reduces chance of error if the type of "dev" changes. While here > remove extra error print out, this is not usually done for memory > allocation failures. > > Signed-off-by: Andrew Davis <afd@ti.com> > --- > drivers/i2c/busses/i2c-davinci.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c > index c55bd937def7..135f76593e6f 100644 > --- a/drivers/i2c/busses/i2c-davinci.c > +++ b/drivers/i2c/busses/i2c-davinci.c > @@ -767,12 +767,9 @@ static int davinci_i2c_probe(struct platform_device *pdev) > if (irq < 0) > return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n"); > > - dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), > - GFP_KERNEL); > - if (!dev) { > - dev_err(&pdev->dev, "Memory allocation failed\n"); > + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); > + if (!dev) > return -ENOMEM; > - } > > init_completion(&dev->cmd_complete); > > -- > 2.39.2 > Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Mon, May 15, 2023 at 12:50:42PM -0500, Andrew Davis wrote: > This reduces chance of error if the type of "dev" changes. While here > remove extra error print out, this is not usually done for memory > allocation failures. > > Signed-off-by: Andrew Davis <afd@ti.com> Applied to for-next, thanks!
> Should desirable changes be split into better update steps?
It is done. It has already been applied.
> Will the patch review attention grow anyhow for affected aspects?
What are "affected aspects" in this case?
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index c55bd937def7..135f76593e6f 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -767,12 +767,9 @@ static int davinci_i2c_probe(struct platform_device *pdev) if (irq < 0) return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n"); - dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), - GFP_KERNEL); - if (!dev) { - dev_err(&pdev->dev, "Memory allocation failed\n"); + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + if (!dev) return -ENOMEM; - } init_completion(&dev->cmd_complete);
This reduces chance of error if the type of "dev" changes. While here remove extra error print out, this is not usually done for memory allocation failures. Signed-off-by: Andrew Davis <afd@ti.com> --- drivers/i2c/busses/i2c-davinci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)