2023-03-06 02:49:52

by Dongliang Mu

[permalink] [raw]
Subject: [PATCH] drivers: i2c: remove dead code in davinci_i2c_probe

From the comment of platform_get_irq, it only returns non-zero IRQ
number and negative error number, other than zero.

Fix this by removing the if condition.

Signed-off-by: Dongliang Mu <[email protected]>
---
drivers/i2c/busses/i2c-davinci.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index c836cf884185..9750310f2c96 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -764,11 +764,8 @@ static int davinci_i2c_probe(struct platform_device *pdev)
int r, irq;

irq = platform_get_irq(pdev, 0);
- if (irq <= 0) {
- if (!irq)
- irq = -ENXIO;
+ 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);
--
2.39.2



2023-03-06 09:28:01

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH] drivers: i2c: remove dead code in davinci_i2c_probe

On Mon, Mar 6, 2023 at 3:48 AM Dongliang Mu <[email protected]> wrote:
>
> From the comment of platform_get_irq, it only returns non-zero IRQ
> number and negative error number, other than zero.
>
> Fix this by removing the if condition.
>
> Signed-off-by: Dongliang Mu <[email protected]>
> ---
> drivers/i2c/busses/i2c-davinci.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index c836cf884185..9750310f2c96 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -764,11 +764,8 @@ static int davinci_i2c_probe(struct platform_device *pdev)
> int r, irq;
>
> irq = platform_get_irq(pdev, 0);
> - if (irq <= 0) {
> - if (!irq)
> - irq = -ENXIO;
> + 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);
> --
> 2.39.2
>

Reviewed-by: Bartosz Golaszewski <[email protected]>

2023-03-16 19:51:10

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] drivers: i2c: remove dead code in davinci_i2c_probe

On Mon, Mar 06, 2023 at 10:45:23AM +0800, Dongliang Mu wrote:
> From the comment of platform_get_irq, it only returns non-zero IRQ
> number and negative error number, other than zero.
>
> Fix this by removing the if condition.
>
> Signed-off-by: Dongliang Mu <[email protected]>

Applied to for-next, thanks!


Attachments:
(No filename) (312.00 B)
signature.asc (833.00 B)
Download all attachments