From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D786C433FE for ; Tue, 8 Dec 2020 23:35:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4469323AA8 for ; Tue, 8 Dec 2020 23:35:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4469323AA8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Vz28YRUlVfsShbqzzoDrI0pv53ODHpUGZC/pXRx8KPo=; b=Aq+52cOzk/SqhlEUY8AA7nPw8 w0WHmnUycoGu5qyEsb/EXX592ruhhppW3bSwYI9mMVze5gDo6J0jMKAoh+p5eRsf2kOodkC0tLeem jln926aZM79PuPCxSdae86etvWY1kpCy9rNqcS+JU9Wi9iZ070QdZJwF+uaQKsWfQq7ExVf8stBiq kDvVHrXOMJhpJoKn5leSz4KLxm8OEE/+mpIwEFJKi3pId9GT7fQdFs/V9Z/6/UQPf/4iqxjCv9Et+ LeNj5Sd7yJH0TgL0N3/qBYkYMgBShUECug8fHdpOP9dYfdt6u7E6kmpxK0SZKTpl/6sjf0rqBX+Hs bh6wbArTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmmVL-0003dw-UW; Tue, 08 Dec 2020 23:34:47 +0000 Received: from mga01.intel.com ([192.55.52.88]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmmVJ-0003c0-6w for linux-arm-kernel@lists.infradead.org; Tue, 08 Dec 2020 23:34:46 +0000 IronPort-SDR: phQhejr375Mh01vByn9zczkWP8xKh1qYXlehghWn79cF4hTebShMScdVMbjmRzF3ULtO5alFeK /SUMUz+lqkgw== X-IronPort-AV: E=McAfee;i="6000,8403,9829"; a="192286979" X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="192286979" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 15:34:41 -0800 IronPort-SDR: h5bnpUi2zZitS92VDr0+o5KfWLNrRGYdOOddyybbuHgxD3WgHCqDTVmAgcvboXHf2j8tX/q13w EoufAQvO/V2A== X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="375334145" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 15:34:38 -0800 Received: by paasikivi.fi.intel.com (Postfix, from userid 1000) id 81FF520867; Wed, 9 Dec 2020 01:34:36 +0200 (EET) Date: Wed, 9 Dec 2020 01:34:36 +0200 From: Sakari Ailus To: Paul Kocialkowski Subject: Re: [PATCH v4 2/2] media: i2c: Add support for the OV5648 image sensor Message-ID: <20201208233436.GF25763@paasikivi.fi.intel.com> References: <20201128143350.531460-1-paul.kocialkowski@bootlin.com> <20201128143350.531460-3-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201128143350.531460-3-paul.kocialkowski@bootlin.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201208_183445_410054_2F42A4B0 X-CRM114-Status: GOOD ( 16.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Ripard , Hans Verkuil , Rob Herring , Thomas Petazzoni , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Paul, On Sat, Nov 28, 2020 at 03:33:50PM +0100, Paul Kocialkowski wrote: ... > + if (ret) > + goto error_ctrls; > + > + /* V4L2 subdev register */ > + > + ret = v4l2_async_register_subdev_sensor_common(subdev); The driver's device node may be already available to the user here... > + if (ret) > + goto error_ctrls; > + > + /* Runtime PM */ > + > + pm_runtime_enable(sensor->dev); > + pm_runtime_set_suspended(sensor->dev); but runtime PM is enabled here. This needs to be done in a different order. Otherwise chances are that the device node is accessed before the device is powered on. > + > + return 0; > + > +error_ctrls: > + v4l2_ctrl_handler_free(&sensor->ctrls.handler); > + > +error_mutex: > + mutex_destroy(&sensor->mutex); > + > +error_entity: > + media_entity_cleanup(&sensor->subdev.entity); > + > +error_endpoint: > + v4l2_fwnode_endpoint_free(&sensor->endpoint); > + > + return ret; > +} > + > +static int ov5648_remove(struct i2c_client *client) > +{ > + struct v4l2_subdev *subdev = i2c_get_clientdata(client); > + struct ov5648_sensor *sensor = ov5648_subdev_sensor(subdev); > + > + clk_rate_exclusive_put(sensor->xvclk); > + > + v4l2_async_unregister_subdev(subdev); > + mutex_destroy(&sensor->mutex); > + media_entity_cleanup(&subdev->entity); > + v4l2_device_unregister_subdev(subdev); > + pm_runtime_disable(sensor->dev); > + > + ov5648_sensor_power(sensor, false); This needs to go, too, as there's no corresponding operation that powered on the device. Also don't forget to release the control handler. I believe these apply to both of the two drivers. -- Kind regards, Sakari Ailus _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel