On Wed, Mar 17, 2021 at 05:14:34PM -0400, min.li...@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

Reply via email to