diff mbox series

[-next] spi: s3c24xx: Switch to use devm_spi_alloc_master()

Message ID 20220920114901.2683267-1-yangyingliang@huawei.com (mailing list archive)
State Superseded
Headers show
Series [-next] spi: s3c24xx: Switch to use devm_spi_alloc_master() | expand

Commit Message

Yang Yingliang Sept. 20, 2022, 11:49 a.m. UTC
Switch to use devm_spi_alloc_master() to simpify error path.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/spi/spi-s3c24xx.c | 32 ++++++++++----------------------
 1 file changed, 10 insertions(+), 22 deletions(-)

Comments

Krzysztof Kozlowski Sept. 20, 2022, 12:56 p.m. UTC | #1
On 20/09/2022 13:49, Yang Yingliang wrote:
(...)

>  
>  	s3c24xx_spi_initialsetup(hw);
> @@ -531,17 +525,11 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
>  	err = spi_bitbang_start(&hw->bitbang);
>  	if (err) {
>  		dev_err(&pdev->dev, "Failed to register SPI master\n");
> -		goto err_register;
> +		clk_disable(hw->clk);
> +		return err;
>  	}
>  
>  	return 0;
> -
> - err_register:
> -	clk_disable(hw->clk);

This label and error handling should rather stay.


Best regards,
Krzysztof
Krzysztof Kozlowski Sept. 20, 2022, 12:57 p.m. UTC | #2
On 20/09/2022 13:49, Yang Yingliang wrote:
> Switch to use devm_spi_alloc_master() to simpify error path.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

One more comment - the patch was not properly addressed.

Use scripts/get_maintainers.pl to CC all maintainers and relevant
mailing lists.


Best regards,
Krzysztof
Yang Yingliang Sept. 20, 2022, 1:05 p.m. UTC | #3
Hi,

On 2022/9/20 20:57, Krzysztof Kozlowski wrote:
> On 20/09/2022 13:49, Yang Yingliang wrote:
>> Switch to use devm_spi_alloc_master() to simpify error path.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> One more comment - the patch was not properly addressed.
>
> Use scripts/get_maintainers.pl to CC all maintainers and relevant
> mailing lists.
Do I need to resend it with CC all maintainers ?

Thanks,
Yang
>
>
> Best regards,
> Krzysztof
> .
Krzysztof Kozlowski Sept. 20, 2022, 1:14 p.m. UTC | #4
On 20/09/2022 15:05, Yang Yingliang wrote:
> Hi,
> 
> On 2022/9/20 20:57, Krzysztof Kozlowski wrote:
>> On 20/09/2022 13:49, Yang Yingliang wrote:
>>> Switch to use devm_spi_alloc_master() to simpify error path.
>>>
>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> One more comment - the patch was not properly addressed.
>>
>> Use scripts/get_maintainers.pl to CC all maintainers and relevant
>> mailing lists.
> Do I need to resend it with CC all maintainers ?
> 

Resend? No. You need to send new version, with fix I asked for, Ccing
all necessary people and mailing lists.

Best regards,
Krzysztof
Yang Yingliang Sept. 20, 2022, 1:31 p.m. UTC | #5
On 2022/9/20 21:14, Krzysztof Kozlowski wrote:
> On 20/09/2022 15:05, Yang Yingliang wrote:
>> Hi,
>>
>> On 2022/9/20 20:57, Krzysztof Kozlowski wrote:
>>> On 20/09/2022 13:49, Yang Yingliang wrote:
>>>> Switch to use devm_spi_alloc_master() to simpify error path.
>>>>
>>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>>> One more comment - the patch was not properly addressed.
>>>
>>> Use scripts/get_maintainers.pl to CC all maintainers and relevant
>>> mailing lists.
>> Do I need to resend it with CC all maintainers ?
>>
> Resend? No. You need to send new version, with fix I asked for, Ccing
> all necessary people and mailing lists.
I received this mail first, I missed the comment in another mail when I
was replying this mail.
Yeah, I will send a v2 later.

Thanks,
Yang
>
> Best regards,
> Krzysztof
> .
diff mbox series

Patch

diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
index 660aa866af06..e941803a2557 100644
--- a/drivers/spi/spi-s3c24xx.c
+++ b/drivers/spi/spi-s3c24xx.c
@@ -449,7 +449,7 @@  static int s3c24xx_spi_probe(struct platform_device *pdev)
 	struct spi_master *master;
 	int err = 0;
 
-	master = spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi));
+	master = devm_spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi));
 	if (master == NULL) {
 		dev_err(&pdev->dev, "No memory for spi_master\n");
 		return -ENOMEM;
@@ -463,8 +463,7 @@  static int s3c24xx_spi_probe(struct platform_device *pdev)
 
 	if (pdata == NULL) {
 		dev_err(&pdev->dev, "No platform data supplied\n");
-		err = -ENOENT;
-		goto err_no_pdata;
+		return -ENOENT;
 	}
 
 	platform_set_drvdata(pdev, hw);
@@ -499,29 +498,24 @@  static int s3c24xx_spi_probe(struct platform_device *pdev)
 
 	/* find and map our resources */
 	hw->regs = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(hw->regs)) {
-		err = PTR_ERR(hw->regs);
-		goto err_no_pdata;
-	}
+	if (IS_ERR(hw->regs))
+		return PTR_ERR(hw->regs);
 
 	hw->irq = platform_get_irq(pdev, 0);
-	if (hw->irq < 0) {
-		err = -ENOENT;
-		goto err_no_pdata;
-	}
+	if (hw->irq < 0)
+		return -ENOENT;
 
 	err = devm_request_irq(&pdev->dev, hw->irq, s3c24xx_spi_irq, 0,
 				pdev->name, hw);
 	if (err) {
 		dev_err(&pdev->dev, "Cannot claim IRQ\n");
-		goto err_no_pdata;
+		return err;
 	}
 
 	hw->clk = devm_clk_get(&pdev->dev, "spi");
 	if (IS_ERR(hw->clk)) {
 		dev_err(&pdev->dev, "No clock for device\n");
-		err = PTR_ERR(hw->clk);
-		goto err_no_pdata;
+		return PTR_ERR(hw->clk);
 	}
 
 	s3c24xx_spi_initialsetup(hw);
@@ -531,17 +525,11 @@  static int s3c24xx_spi_probe(struct platform_device *pdev)
 	err = spi_bitbang_start(&hw->bitbang);
 	if (err) {
 		dev_err(&pdev->dev, "Failed to register SPI master\n");
-		goto err_register;
+		clk_disable(hw->clk);
+		return err;
 	}
 
 	return 0;
-
- err_register:
-	clk_disable(hw->clk);
-
- err_no_pdata:
-	spi_master_put(hw->master);
-	return err;
 }
 
 static int s3c24xx_spi_remove(struct platform_device *dev)