@@ -449,7 +449,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
449
449
struct spi_master * master ;
450
450
int err = 0 ;
451
451
452
- master = spi_alloc_master (& pdev -> dev , sizeof (struct s3c24xx_spi ));
452
+ master = devm_spi_alloc_master (& pdev -> dev , sizeof (struct s3c24xx_spi ));
453
453
if (master == NULL ) {
454
454
dev_err (& pdev -> dev , "No memory for spi_master\n" );
455
455
return - ENOMEM ;
@@ -463,8 +463,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
463
463
464
464
if (pdata == NULL ) {
465
465
dev_err (& pdev -> dev , "No platform data supplied\n" );
466
- err = - ENOENT ;
467
- goto err_no_pdata ;
466
+ return - ENOENT ;
468
467
}
469
468
470
469
platform_set_drvdata (pdev , hw );
@@ -499,29 +498,24 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
499
498
500
499
/* find and map our resources */
501
500
hw -> regs = devm_platform_ioremap_resource (pdev , 0 );
502
- if (IS_ERR (hw -> regs )) {
503
- err = PTR_ERR (hw -> regs );
504
- goto err_no_pdata ;
505
- }
501
+ if (IS_ERR (hw -> regs ))
502
+ return PTR_ERR (hw -> regs );
506
503
507
504
hw -> irq = platform_get_irq (pdev , 0 );
508
- if (hw -> irq < 0 ) {
509
- err = - ENOENT ;
510
- goto err_no_pdata ;
511
- }
505
+ if (hw -> irq < 0 )
506
+ return - ENOENT ;
512
507
513
508
err = devm_request_irq (& pdev -> dev , hw -> irq , s3c24xx_spi_irq , 0 ,
514
509
pdev -> name , hw );
515
510
if (err ) {
516
511
dev_err (& pdev -> dev , "Cannot claim IRQ\n" );
517
- goto err_no_pdata ;
512
+ return err ;
518
513
}
519
514
520
515
hw -> clk = devm_clk_get (& pdev -> dev , "spi" );
521
516
if (IS_ERR (hw -> clk )) {
522
517
dev_err (& pdev -> dev , "No clock for device\n" );
523
- err = PTR_ERR (hw -> clk );
524
- goto err_no_pdata ;
518
+ return PTR_ERR (hw -> clk );
525
519
}
526
520
527
521
s3c24xx_spi_initialsetup (hw );
@@ -539,8 +533,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
539
533
err_register :
540
534
clk_disable (hw -> clk );
541
535
542
- err_no_pdata :
543
- spi_master_put (hw -> master );
544
536
return err ;
545
537
}
546
538
0 commit comments