Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2365653ybl; Thu, 9 Jan 2020 11:27:18 -0800 (PST) X-Google-Smtp-Source: APXvYqwZiwSRVJlimVD6RPVDj8UzTnn7aiercreBYgrKO54VrgAAEzw16NZzin1dPKFmpHh5n4aS X-Received: by 2002:a9d:67ce:: with SMTP id c14mr9647200otn.106.1578598038456; Thu, 09 Jan 2020 11:27:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578598038; cv=none; d=google.com; s=arc-20160816; b=E2RMbdU6xPoWupYWaQR5c3WdzD0dX8kSxptwqB+vf3QdxRUu5ZafZ5VRo5pg+X+BR0 hdA6Dp9PhCpi6o5WNYjFVgGHwUoznRKF5ju9SdGq3MRKOzfHMwVACVv0tDOl1rAv0hvF wNxbXgrdOtnc+PdA657u1LELO/L6T0sx3oDbzJbCrtyObzJPkoUQZB1Gbqe+Nnq4IEij LiFgbSzY/bLeeF3bBq+Q+JB5Johy2JDKlavrAa+Nec6LRLCCT3HO2kuGK7K2+nqE4SMk +TB1+A0AQJB4HXEXiFIJbVxbVKycvZ+NAEZm8crZaVJZ58DlMlOXGQg+RUqaHTYeoThA dYvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=tU8F4WsU21jiXq2FI+7YaCkgK9jzgKYlQpVEKJ9htjc=; b=Wie49ZbQI15VAjlZ7RbIhrWEh3BZG/sz1nikjsU9YEaL3jQ7sIzI7sCv4xiirLuGAc 59Y60h8wDwzVBEWa2T6CH16pcmJNIWePFxe/zHdWuePB06dYivGZEOhh3SHTTaxQ6AyB wmVprM/pnCrfoeY++Wqaegiz4144rEd254ZQM0XOamnl9YcBBJWW+UQTxZSh6BKPixGv f1M/s/2mGeDzSg7aWjPn2oJLJxyyYq9MaJChQcHBPS2KGbWAtyGjo8Hz6ByvMwEFzPO0 qFIIdm+ThLeT1NZk04QkU4GSZDghRNDt5q/dwfgMuVRNk51MLXuxPV1hU7xt2fn8oMRG j4OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ChgxqELA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w196si4239033oia.135.2020.01.09.11.27.05; Thu, 09 Jan 2020 11:27:18 -0800 (PST) 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=@kernel.org header.s=default header.b=ChgxqELA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732669AbgAIPyk (ORCPT + 99 others); Thu, 9 Jan 2020 10:54:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:33410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729591AbgAIPyk (ORCPT ); Thu, 9 Jan 2020 10:54:40 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA078206ED; Thu, 9 Jan 2020 15:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578585279; bh=CO2oAXeI60Yqe46XfH5899cbMwfHKmsfrdFWFp4IkwY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ChgxqELAE5vIbirpB/5834tX0zLmq/6Qkuwk3PhP6YsOSsJDsGlEhIyTXox1JsuJN B1OIZI0Cw440zjgdeGT0HZFi52lZIWWtxsYhHreFRGpfMlj3sPcQYGOOAw2rt9a52Q sqj3ztbeMWxnUDTLUqyEnMlliuBSWr8muk4dTo5Y= Date: Thu, 9 Jan 2020 16:54:37 +0100 From: Greg KH To: "Daniel W. S. Almeida" Cc: mchehab@kernel.org, sean@mess.org, tglx@linutronix.de, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [PATCH 1/1] media: dvb_dummy_tuner: implement driver skeleton Message-ID: <20200109155437.GA568342@kroah.com> References: <20200109152408.919325-1-dwlsalmeida@gmail.com> <20200109152408.919325-2-dwlsalmeida@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200109152408.919325-2-dwlsalmeida@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 09, 2020 at 12:24:08PM -0300, Daniel W. S. Almeida wrote: > +static int dvb_dummy_tuner_i2c_probe(struct i2c_client *client, > + const struct i2c_device_id *id) > +{ > + int ret = 0; > + struct dvb_dummy_tuner_config *config = client->dev.platform_data; > + struct dvb_frontend *fe = config->fe; > + struct dvb_dummy_tuner_dev *tuner_dev = NULL; > + > + tuner_dev = kzalloc(sizeof(*tuner_dev), GFP_KERNEL); > + if (!tuner_dev) { > + ret = -ENOMEM; > + goto err; > + } > + > + i2c_set_clientdata(client, tuner_dev); > + tuner_dev->fe = config->fe; > + > + memcpy(&fe->ops.tuner_ops, > + &dvb_dummy_tuner_ops, > + sizeof(struct dvb_tuner_ops)); > + > + fe->tuner_priv = client; > + > + pr_debug("%s: Successfully probed %s\n", __func__, client->name); As you are a driver, you should never need to call any pr_* calls, instead use dev_*(). For this, you can use dev_dbg(), but really, why is that even needed except for your debugging bringup. And for that, you can use ftrace, right? So no need for any printing of anything here. > + return ret; > + > +err: > + pr_err("%s: failed\n", __func__); Again, dev_err() would be proper, but there's no need for any error message here. Don't you need to register the tuner ops with something in this function? > + return ret; > +} > + > +static int dvb_dummy_tuner_i2c_remove(struct i2c_client *client) > +{ > + struct dvb_dummy_tuner_dev *tuner_dev = i2c_get_clientdata(client); > + struct dvb_frontend *fe = tuner_dev->fe; > + > + memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops)); > + fe->tuner_priv = NULL; > + kfree(tuner_dev); > + Don't you need to unregister the tuner ops in here? thanks, greg k-h