[PATCH] drm/bridge: tpd12s015: Fix irq registering in tpd12s015_probe

Yuehaibing yuehaibing at huawei.com
Sat Oct 31 12:32:23 UTC 2020


On 2020/10/31 15:19, Sam Ravnborg wrote:
> Hi YueHaibing
> 
> Thanks for the fix. Appreciated but please update as per comments below.
> 
> On Sat, Oct 31, 2020 at 11:16:48AM +0800, YueHaibing wrote:
>> gpiod_to_irq() return negative value in case of error,
>> the existing code handle negative error codes wrongly.
>>
>> Fixes: cff5e6f7e83f ("drm/bridge: Add driver for the TI TPD12S015 HDMI level shifter")
>> Signed-off-by: YueHaibing <yuehaibing at huawei.com>
>> ---
>>  drivers/gpu/drm/bridge/ti-tpd12s015.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/ti-tpd12s015.c b/drivers/gpu/drm/bridge/ti-tpd12s015.c
>> index 514cbf0eac75..a18d5197c16c 100644
>> --- a/drivers/gpu/drm/bridge/ti-tpd12s015.c
>> +++ b/drivers/gpu/drm/bridge/ti-tpd12s015.c
>> @@ -160,7 +160,7 @@ static int tpd12s015_probe(struct platform_device *pdev)
>>  
>>  	/* Register the IRQ if the HPD GPIO is IRQ-capable. */
>>  	tpd->hpd_irq = gpiod_to_irq(tpd->hpd_gpio);
>> -	if (tpd->hpd_irq) {
>> +	if (tpd->hpd_irq > 0) {
>>  		ret = devm_request_threaded_irq(&pdev->dev, tpd->hpd_irq, NULL,
>>  						tpd12s015_hpd_isr,
>>  						IRQF_TRIGGER_RISING |
> 
> The current implmentation will skip devm_request_threaded_irq() in case
> or error - but continue with the rest of the function. So the
> driver fails to return an error code.
> 
> In case of error (negative value) then return early with that error

Agree, will resubmit.

> value. If gpiod_to_irq() returns 0 assume this is a valid irq and let
> the code continue.

gpiod_to_irq() never returns 0, so no need check this.

> 
> Please fix and re-submit - or tell me if I am mistaken.
> 
> 	Sam
> .
> 


More information about the dri-devel mailing list