From: Greg KH <gregkh@linuxfoundation.org>
To: min.li.xe@renesas.com
Cc: derek.kiernan@xilinx.com, dragan.cvetic@xilinx.com,
arnd@arndb.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH char-misc v1] misc: Add Renesas Synchronization Management Unit (SMU) support
Date: Thu, 18 Mar 2021 06:49:30 +0100 [thread overview]
Message-ID: <YFLp6n70JBXDYvxI@kroah.com> (raw)
In-Reply-To: <1616015674-4589-1-git-send-email-min.li.xe@renesas.com>
On Wed, Mar 17, 2021 at 05:14:34PM -0400, min.li.xe@renesas.com wrote:
> +static int
> +rsmu_open(struct inode *iptr, struct file *fptr)
> +{
> + struct rsmu_cdev *rsmu;
> +
> + rsmu = container_of(iptr->i_cdev, struct rsmu_cdev, rsmu_cdev);
> + if (!rsmu)
> + return -EAGAIN;
This check will never happen, so why are you making it?
And what does -EAGIN mean in this case?
> +
> + fptr->private_data = rsmu;
> + return 0;
> +}
> +
> +static int
> +rsmu_release(struct inode *iptr, struct file *fptr)
> +{
> + struct rsmu_cdev *rsmu;
> +
> + rsmu = container_of(iptr->i_cdev, struct rsmu_cdev, rsmu_cdev);
> + if (!rsmu)
> + return -EAGAIN;
Same here, this is impossible to ever have happen. Please look up how
container_of() works.
> +
> + return 0;
> +}
> +
> +static long
> +rsmu_ioctl(struct file *fptr, unsigned int cmd, unsigned long data)
> +{
> + struct rsmu_cdev *rsmu = fptr->private_data;
> + void __user *arg = (void __user *)data;
> + int err = 0;
> +
> + if (!rsmu)
> + return -EINVAL;
How can this happen?
Why all of these impossible checks?
And the build failures that the kernel test robot obviously need to be
fixed as well...
thanks,
greg k-h
prev parent reply other threads:[~2021-03-18 5:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 21:14 [PATCH char-misc v1] misc: Add Renesas Synchronization Management Unit (SMU) support min.li.xe
2021-03-17 23:05 ` kernel test robot
2021-03-18 1:30 ` kernel test robot
2021-03-18 5:49 ` Greg KH [this message]
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=YFLp6n70JBXDYvxI@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--cc=derek.kiernan@xilinx.com \
--cc=dragan.cvetic@xilinx.com \
--cc=linux-kernel@vger.kernel.org \
--cc=min.li.xe@renesas.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).