Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp510478pxb; Wed, 27 Jan 2021 13:25:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlN+owfr0wmERVJZ9WucntY4KcF5+lt23MxNpQwEPodDUQ66MMNrUF7qrVC9l4nGoZ6htM X-Received: by 2002:a05:6402:4ce:: with SMTP id n14mr10883540edw.309.1611782750515; Wed, 27 Jan 2021 13:25:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611782750; cv=none; d=google.com; s=arc-20160816; b=R2WHmxM52qZQefJVk8aCrt/qk7hSNR/eoikFFjbv3JiDcEGbVQ4yFO07LoxpQyIqXN cIrdPcWPqCES1SjEzQq59duxTTBPVh0gKG4A6cwE/rXFrfOESf3TwNDAOOXVrpDz5uan pDTx7XYw8nc2dH6naWglnlx+htqWwMY47fynfKym79T8O3ChgMFhkY2wlpuRyoFCxntA BOh6S2vbQM25ydJ7mhaVFxogXJY/355YhlEe/P91p+zLeMLab1PyEJQRjIn7Q2gGEce+ 5zdcHlv/g9ezET0vAVuXL5ppXbeCEFGToOM40bRpvH0nqZjN2eGT3GKGPJk2ETCAV5i6 sOaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Lxj8bEelE23lP5Yarr1kv02daEJS+HwhDWx2YUgzflE=; b=ZxI98KIEyPnMHUNkIa2BqD2wUth44+rfHnfOMXKleBsDImC06FqQuszxqMvwiJ5lpB L/qstn8qJCJEtkQb6tsyXcySNaoNwGUfNc9+B0xGdiBQTNnHxXoN6c92BqS559pRvfMe iNGH4IdSW7nY61RHaCqsUndzvyUiZhKJPB9NznBK6Kx2nV3p0lYOtjtx6B4SCtYV+yLL gIVZZQlGkPYbRs2YJBcHdMdREFDdDcNVHWRe9CXlGLIiRy8HPdk/PErYOUHxRGANGeGD MnpQavcRN+ldir6nxVScqQCtW5DVDW8L39zFtVNdZVAM29a1GG57w2556vmbhGkeQouu lz5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="AZ6KZX/z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kx4si1358674ejc.636.2021.01.27.13.25.23; Wed, 27 Jan 2021 13:25:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="AZ6KZX/z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235698AbhA0GIj (ORCPT + 99 others); Wed, 27 Jan 2021 01:08:39 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:48336 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232697AbhA0Fqj (ORCPT ); Wed, 27 Jan 2021 00:46:39 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10R5Yuwf195850; Wed, 27 Jan 2021 05:45:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=Lxj8bEelE23lP5Yarr1kv02daEJS+HwhDWx2YUgzflE=; b=AZ6KZX/zZLPFJpqpb5Sz+JZt1Ekr8g8fcokY5ZpNf0+DkMlJ1Zd+vuQ3+ZglzKn5risD qXc2YbDEUY56YlbyHL+i8U2W8bdgT/db+uClZqCVSx1qStUvmaE46SqCOmWUsv3Zu9OK MfU3G7b4SR5dVF38O6ngZ7hmfoDFaGQhFbkcAkRKYpBHBHE5D4UOkX4tFTjOs8Q37CPf 4mqbVUGdgXpN0IqLHsWPTEJc3jUrfENacWiMFq5h4+4JA9G6dYy6ndETp06a56YD+Npb oaW2d2A4yMYdsiydDYLNOz7R95tSPM0one7JFDWLIBVHKMQIQGIc+XOG6AH2kScAdXut mw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 368b7qw9rh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Jan 2021 05:45:45 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10R5UaNg018456; Wed, 27 Jan 2021 05:45:42 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 368wpytx1x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Jan 2021 05:45:42 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 10R5jV6J004430; Wed, 27 Jan 2021 05:45:32 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 26 Jan 2021 21:45:31 -0800 Date: Wed, 27 Jan 2021 08:45:23 +0300 From: Dan Carpenter To: Carlis Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-fbdev@vger.kernel.org, mh12gx2825@gmail.com, oliver.graute@kococonnector.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, sbrivio@redhat.com, colin.king@canonical.com, zhangxuezhi1@yulong.com Subject: Re: [PATCH v5] fbtft: add tearing signal detect Message-ID: <20210127054523.GA2696@kadam> References: <1611711140-68260-1-git-send-email-zhangxuezhi3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1611711140-68260-1-git-send-email-zhangxuezhi3@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9876 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101270032 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9876 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101270032 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 27, 2021 at 09:32:20AM +0800, Carlis wrote: > @@ -82,6 +111,29 @@ enum st7789v_command { > */ > static int init_display(struct fbtft_par *par) > { > + int rc; > + struct device *dev = par->info->device; > + > + par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0, GPIOD_IN); > + if (par->gpio.te) { > + init_completion(&spi_panel_te); > + mutex_init(&te_mutex); > + rc = devm_request_irq(dev, > + gpiod_to_irq(par->gpio.te), > + spi_panel_te_handler, IRQF_TRIGGER_RISING, > + "TE_GPIO", par); > + if (rc) { > + pr_err("TE request_irq failed.\n"); > + devm_gpiod_put(dev, par->gpio.te); > + par->gpio.te = NULL; > + } else { > + disable_irq_nosync(gpiod_to_irq(par->gpio.te)); > + pr_info("TE request_irq completion.\n"); > + } > + } else { > + pr_info("%s:%d, TE gpio not specified\n", > + __func__, __LINE__); > + } I'm sorry that I was not clear before. This code will crash if devm_gpiod_get_index_optional() returns an error. You *NEED* to check for error pointers and return the error code. Write it exactly like this: par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0, GPIOD_IN); if (IS_ERR(par->gpio.te)) return PTR_ERR(par->gpio.te); if (par->gpio.te) { init_completion(&spi_panel_te); regards, dan carpenter