diff mbox

[-next] Input: synaptics-rmi4 - fix error return code in rmi_probe_interrupts()

Message ID 20170207145225.31228-1-weiyj.lk@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Wei Yongjun Feb. 7, 2017, 2:52 p.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com>

Fix to return error code -ENOMEM from the devm_kzalloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: 6bd0dcfacf28 ("Input: synaptics-rmi4 - factor out functions
from probe")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/input/rmi4/rmi_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Benjamin Tissoires Feb. 7, 2017, 3 p.m. UTC | #1
On Feb 07 2017 or thereabouts, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Fix to return error code -ENOMEM from the devm_kzalloc() error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 6bd0dcfacf28 ("Input: synaptics-rmi4 - factor out functions
> from probe")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---

Good catch.

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

>  drivers/input/rmi4/rmi_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
> index bf5c36e..0c54446 100644
> --- a/drivers/input/rmi4/rmi_driver.c
> +++ b/drivers/input/rmi4/rmi_driver.c
> @@ -1049,7 +1049,7 @@ int rmi_probe_interrupts(struct rmi_driver_data *data)
>  	data->irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL);
>  	if (!data->irq_memory) {
>  		dev_err(dev, "Failed to allocate memory for irq masks.\n");
> -		return retval;
> +		return -ENOMEM;
>  	}
>  
>  	data->irq_status	= data->irq_memory + size * 0;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov Feb. 7, 2017, 6 p.m. UTC | #2
On Tue, Feb 07, 2017 at 04:00:37PM +0100, Benjamin Tissoires wrote:
> On Feb 07 2017 or thereabouts, Wei Yongjun wrote:
> > From: Wei Yongjun <weiyongjun1@huawei.com>
> > 
> > Fix to return error code -ENOMEM from the devm_kzalloc() error handling
> > case instead of 0, as done elsewhere in this function.
> > 
> > Fixes: 6bd0dcfacf28 ("Input: synaptics-rmi4 - factor out functions
> > from probe")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> 
> Good catch.
> 
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Applied, thank you.

> 
> >  drivers/input/rmi4/rmi_driver.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
> > index bf5c36e..0c54446 100644
> > --- a/drivers/input/rmi4/rmi_driver.c
> > +++ b/drivers/input/rmi4/rmi_driver.c
> > @@ -1049,7 +1049,7 @@ int rmi_probe_interrupts(struct rmi_driver_data *data)
> >  	data->irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL);
> >  	if (!data->irq_memory) {
> >  		dev_err(dev, "Failed to allocate memory for irq masks.\n");
> > -		return retval;
> > +		return -ENOMEM;
> >  	}
> >  
> >  	data->irq_status	= data->irq_memory + size * 0;
> >
diff mbox

Patch

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index bf5c36e..0c54446 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -1049,7 +1049,7 @@  int rmi_probe_interrupts(struct rmi_driver_data *data)
 	data->irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL);
 	if (!data->irq_memory) {
 		dev_err(dev, "Failed to allocate memory for irq masks.\n");
-		return retval;
+		return -ENOMEM;
 	}
 
 	data->irq_status	= data->irq_memory + size * 0;