linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Lee Jones <lee.jones@linaro.org>
Cc: hans.verkuil@cisco.com, mchehab@kernel.org,
	benjamin.gaignard@st.com, patrice.chotard@st.com,
	linux-kernel@vger.kernel.org, kernel@stlinux.com,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 2/2] [media] cec: Handle RC capability more elegantly
Date: Tue, 4 Apr 2017 17:34:55 +0100	[thread overview]
Message-ID: <20170404163455.GD7909@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20170404161005.20884-2-lee.jones@linaro.org>

On Tue, Apr 04, 2017 at 05:10:05PM +0100, Lee Jones wrote:
> @@ -237,7 +241,6 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
>  	if (!(caps & CEC_CAP_RC))
>  		return adap;
>  
> -#if IS_REACHABLE(CONFIG_RC_CORE)
>  	/* Prepare the RC input device */
>  	adap->rc = rc_allocate_device(RC_DRIVER_SCANCODE);
>  	if (!adap->rc) {

The above, coupled with patch 1:

+#ifdef CONFIG_RC_CORE
 struct rc_dev *rc_allocate_device(enum rc_driver_type);
+#else
+static inline struct rc_dev *rc_allocate_device(int unused)
+{
+       return ERR_PTR(-EOPNOTSUPP);
+}
+#endif

is really not nice.  You claim that this is how stuff is done elsewhere
in the kernel, but no, it isn't.  Look at debugfs.

You're right that debugfs returns an error pointer when it's not
configured.  However, the debugfs dentry is only ever passed back into
the debugfs APIs, it is never dereferenced by the caller.

That is not the case here.  The effect if your change is that the
following dereferences will oops the kernel.  This is unacceptable for
a feature that is deconfigured.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2017-04-04 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 16:10 [PATCH 1/2] [media] rc-core: Add inlined stubs for core rc_* functions Lee Jones
2017-04-04 16:10 ` [PATCH 2/2] [media] cec: Handle RC capability more elegantly Lee Jones
2017-04-04 16:34   ` Russell King - ARM Linux [this message]
2017-04-05  9:09     ` Lee Jones
  -- strict thread matches above, loose matches on Subject: below --
2017-04-05 10:37 [PATCH 1/2] [media] rc-core: Add inlined stubs for core rc_* functions Lee Jones
2017-04-05 10:37 ` [PATCH 2/2] [media] cec: Handle RC capability more elegantly Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170404163455.GD7909@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=benjamin.gaignard@st.com \
    --cc=hans.verkuil@cisco.com \
    --cc=kernel@stlinux.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=patrice.chotard@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).