Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp905869ybp; Wed, 9 Oct 2019 06:08:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHp9FfB68Kxobiz9h+DzEx+RazZOQacwbP4CxEhiM3gTCxluPvHqW6cvpTzbYLdjGvNWBL X-Received: by 2002:a17:906:5e50:: with SMTP id b16mr2747949eju.156.1570626489752; Wed, 09 Oct 2019 06:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570626489; cv=none; d=google.com; s=arc-20160816; b=uDbdLVvTRvZkLvn0MBfe21S5ldsmLZjY5D5XowlAVG6HU0K2oU+z4gqrtYusPHyLqN CAgpgHVo6OOsCrQu/f8eXuLJ8gCBvI1WZW/7IhFXpggKQZZersZcPmuAJsC+LjoNNxDs f7+dPolSF646xpUS8z5S7MVPk7CvU35Yfc7XpKXm/++Djqy0x9KC1dQHag/kRHXROerz kan6EfFBWpXvIU/BAQAbjGfZfbRmVRWYOWuvR7k9jIVuhP5w5JvXyhaRNrcp2cIaARPl M+VTB8uBOKsC8Kp4e/ftfNpnvOhA3aZqYgnhdkL4dmDkTBDLTiHWYygS3gkS16lqhlYy nnUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Oks/0v4+cEI4DXjuhEPuS+2hzvux1aGr0Tslm3/CeGs=; b=OK4e11wcAYGIQnRZXdHcQBhedHIM6O3hfaJEDEPtYwFJPZw6Oy7C3RaKfXiicQeBPD g/9Hxw34wz3lBFEwpEDcFpn0ahuEi+wu1xNOB4PK28+yAGxGXt91kSJIJbULsDEwflTt NjjPqLWb+EobS/sgnaVtMa3bXD/F6hl77pbwDV2JusoB7e7qKzyQs5fs7S1nlK3YER4X 5H2+Dv4ujdW7rz9ID+Oc1FN73mFpbJFdEKaKxb3VfU1meoVToktI9Dymwyah6Khsvz9Y A62OTyPmYk7xoO/s7lEJYNCTVAO3iP93ce3EVnbKUB+1QE2kKghDw75dXeJNkygT1elo rjug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=HpC0QAbN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id c48si1339490edc.169.2019.10.09.06.07.44; Wed, 09 Oct 2019 06:08:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=HpC0QAbN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1731306AbfJINH0 (ORCPT + 99 others); Wed, 9 Oct 2019 09:07:26 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:52798 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730858AbfJINH0 (ORCPT ); Wed, 9 Oct 2019 09:07:26 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x99D4Zs5172377; Wed, 9 Oct 2019 13:07:06 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-2019-08-05; bh=Oks/0v4+cEI4DXjuhEPuS+2hzvux1aGr0Tslm3/CeGs=; b=HpC0QAbNwrvFFWfScOjx2tUzw/VQXOGJ5gKbf+n0c/Z2/iCD/EsyXTWht5YQvpHsAJGa erYeNEqWgWnxdXDqPhILlYR47u1OTrMVcIpxKJhErgVdCqOA6p4W92ouLlb9rv5c45DT xkHaaPQ/rjGrh2Uu/bNmzykrdWGORRNTmUHALyYcbgcDK1oK5q8LgS+Nc5vQo9JsOOc1 xDJ4Q5cyq1NRr8H/Wkh4bwy5gvchZZMNH/yJFjVaeRMQk1/GTY9qSZ1L/Rvrbs/XIUkj fGYq3N+WVEOBzcm7dyUzz9ES3DfzYoI5QqJP2qhE+YvVJ7dl2zXL3agKQhqucbq+9jxh Mg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2vek4qm8jf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Oct 2019 13:07:05 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x99D4ATS088871; Wed, 9 Oct 2019 13:07:05 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2vgefcnett-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Oct 2019 13:07:05 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x99D6xac008352; Wed, 9 Oct 2019 13:07:00 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 09 Oct 2019 06:06:59 -0700 Date: Wed, 9 Oct 2019 16:06:45 +0300 From: Dan Carpenter To: Xin Ji Cc: "devel@driverdev.osuosl.org" , Jernej Skrabec , Nicolas Boichat , Jonas Karlman , David Airlie , Neil Armstrong , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Andrzej Hajda , Laurent Pinchart , Daniel Vetter , Sheng Pan Subject: Re: [PATCH v2 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver Message-ID: <20191009130645.GN25098@kadam> References: <6ad16e52cd7591d320001a842fc357d976006ef7.1570588741.git.xji@analogixsemi.com> <20191009113032.GL25098@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191009113032.GL25098@kadam> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9404 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910090125 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9404 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910090125 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 09, 2019 at 02:30:32PM +0300, Dan Carpenter wrote: > > + platform = kzalloc(sizeof(*platform), GFP_KERNEL); > > + if (!platform) { > > + DRM_DEV_ERROR(dev, "failed to allocate driver data\n"); > > + ret = -ENOMEM; > > + goto exit; > > return -ENOMEM; > > > + } > > + > > + pdata = &platform->pdata; > > + > > + /* device tree parsing function call */ > > + ret = anx7625_parse_dt(&client->dev, pdata); > > + if (ret != 0) /* if occurs error */ > > + goto err0; > > != 0 is double negative. Choose better label names. Remove the obvious > comment. > > if (ret) > goto free_platform; > > > + > > + anx7625_init_gpio(platform); > > + > > + /* to access global platform data */ > > + platform->client = client; > > + i2c_set_clientdata(client, platform); > > + > > + if (platform->pdata.extcon_supported) { > > + /* get extcon device from DTS */ > > + platform->extcon = extcon_get_edev_by_phandle(&client->dev, 0); > > + if (PTR_ERR(platform->extcon) == -EPROBE_DEFER) > > + goto err0; > > Preserve the error code. > > > + if (IS_ERR(platform->extcon)) { > > + DRM_DEV_ERROR(&client->dev, > > + "can not get extcon device!"); > > + goto err0; > > Prerve the error code. > > > + } > > + > > + ret = anx7625_extcon_notifier_init(platform); > > + if (ret < 0) > > + goto err0; > > + } > > + > > + atomic_set(&platform->power_status, 0); > > + > > + mutex_init(&platform->lock); > > + > > + if (platform->pdata.gpio_intr_hpd) { > > + INIT_WORK(&platform->work, anx7625_work_func); > > + platform->workqueue = create_workqueue("anx7625_work"); > > + if (!platform->workqueue) { > > + DRM_DEV_ERROR(dev, "failed to create work queue\n"); > > + ret = -ENOMEM; > > + goto err1; > > This goto will crash. Because you have forgotten what the most recently > allocated resource was. It should be "goto free_platform;" still. > > > + } > > + > > + platform->pdata.hpd_irq = > > + gpiod_to_irq(platform->pdata.gpio_intr_hpd); > > + if (platform->pdata.hpd_irq < 0) { > > + DRM_DEV_ERROR(dev, "failed to get gpio irq\n"); > > + goto err1; > > goto free_wq; > > > + } > > + > > + ret = request_threaded_irq(platform->pdata.hpd_irq, > > + NULL, anx7625_intr_hpd_isr, > > + IRQF_TRIGGER_FALLING | > > + IRQF_TRIGGER_RISING | > > + IRQF_ONESHOT, > > + "anx7625-hpd", platform); > > + if (ret < 0) { > > + DRM_DEV_ERROR(dev, "failed to request irq\n"); > > + goto err1; > > + } > > + > > + ret = irq_set_irq_wake(platform->pdata.hpd_irq, 1); > > + if (ret < 0) { > > + DRM_DEV_ERROR(dev, "Request irq for hpd"); > > + DRM_DEV_ERROR(dev, "interrupt wake set fail\n"); > > + goto err1; > > + } > > + > > + ret = enable_irq_wake(platform->pdata.hpd_irq); > > + if (ret < 0) { > > + DRM_DEV_ERROR(dev, "Enable irq for HPD"); > > + DRM_DEV_ERROR(dev, "interrupt wake enable fail\n"); > > + goto err1; > > + } > > + } > > + > > + if (anx7625_register_i2c_dummy_clients(platform, client) != 0) { > > Preserve the error code. > > ret = anx7625_register_i2c_dummy_clients(); > if (ret) > goto free_platform; > I meant goto free_wq here. That's the most recent allocation. regards, dan carpenter