diff mbox

spi/sirf: fix error propagation in spi_sirfsoc_probe()

Message ID 1370467796-4641-1-git-send-email-khoroshilov@ispras.ru (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Alexey Khoroshilov June 5, 2013, 9:29 p.m. UTC
If pinctrl_get_select_default() fails, spi_sirfsoc_probe()
returns IS_ERR(sspi->p) instead of PTR_ERR(sspi->p).

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/spi/spi-sirf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Barry Song June 6, 2013, 1:36 a.m. UTC | #1
2013/6/6 Alexey Khoroshilov <khoroshilov@ispras.ru>:
> If pinctrl_get_select_default() fails, spi_sirfsoc_probe()
> returns IS_ERR(sspi->p) instead of PTR_ERR(sspi->p).
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Acked-by: Barry Song <Baohua.Song@csr.com>

> ---
>  drivers/spi/spi-sirf.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
> index 0808cd5..94c3920 100644
> --- a/drivers/spi/spi-sirf.c
> +++ b/drivers/spi/spi-sirf.c
> @@ -559,9 +559,10 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
>         sspi->bitbang.master->dev.of_node = pdev->dev.of_node;
>
>         sspi->p = pinctrl_get_select_default(&pdev->dev);
> -       ret = IS_ERR(sspi->p);
> -       if (ret)
> +       if (IS_ERR(sspi->p)) {
> +               ret = PTR_ERR(sspi->p);
>                 goto free_master;
> +       }
>
>         sspi->clk = clk_get(&pdev->dev, NULL);
>         if (IS_ERR(sspi->clk)) {
> --
> 1.8.1.2

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
Barry Song June 6, 2013, 1:40 a.m. UTC | #2
2013/6/6 Barry Song <21cnbao@gmail.com>:
> 2013/6/6 Alexey Khoroshilov <khoroshilov@ispras.ru>:
>> If pinctrl_get_select_default() fails, spi_sirfsoc_probe()
>> returns IS_ERR(sspi->p) instead of PTR_ERR(sspi->p).
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
>>
>> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
>
> Acked-by: Barry Song <Baohua.Song@csr.com>

sorry. nack, i think pinctrl_get_select_default(&pdev->dev) should
have been dropped in another patch.

>
>> ---
>>  drivers/spi/spi-sirf.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
>> index 0808cd5..94c3920 100644
>> --- a/drivers/spi/spi-sirf.c
>> +++ b/drivers/spi/spi-sirf.c
>> @@ -559,9 +559,10 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
>>         sspi->bitbang.master->dev.of_node = pdev->dev.of_node;
>>
>>         sspi->p = pinctrl_get_select_default(&pdev->dev);
>> -       ret = IS_ERR(sspi->p);
>> -       if (ret)
>> +       if (IS_ERR(sspi->p)) {
>> +               ret = PTR_ERR(sspi->p);
>>                 goto free_master;
>> +       }
>>
>>         sspi->clk = clk_get(&pdev->dev, NULL);
>>         if (IS_ERR(sspi->clk)) {
>> --
>> 1.8.1.2

-barry

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
diff mbox

Patch

diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index 0808cd5..94c3920 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -559,9 +559,10 @@  static int spi_sirfsoc_probe(struct platform_device *pdev)
 	sspi->bitbang.master->dev.of_node = pdev->dev.of_node;
 
 	sspi->p = pinctrl_get_select_default(&pdev->dev);
-	ret = IS_ERR(sspi->p);
-	if (ret)
+	if (IS_ERR(sspi->p)) {
+		ret = PTR_ERR(sspi->p);
 		goto free_master;
+	}
 
 	sspi->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(sspi->clk)) {