lkml.org 
[lkml]   [2021]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5] platform/x86: Add Intel Software Defined Silicon driver
On Thu, Sep 30, 2021 at 06:28:15PM -0700, David E. Box wrote:
> +static int sdsi_device_open(struct inode *inode, struct file *file)
> +{
> + struct miscdevice *miscdev = file->private_data;
> +
> + get_device(miscdev->this_device);

Why do you think this is needed? Shouldn't the misc core handle all of
this for you already?

> +
> + return 0;
> +}
> +
> +static int sdsi_device_release(struct inode *inode, struct file *file)
> +{
> +
> + struct miscdevice *miscdev = file->private_data;
> + struct sdsi_priv *priv = to_sdsi_priv(miscdev);
> +
> + if (priv->akc_owner == file)
> + priv->akc_owner = NULL;

Why is this needed?

> +
> + put_device(miscdev->this_device);

I see this matches the open call, but if you do not have this in the
open call, is it needed here as well?

> + ret = devm_add_action_or_reset(priv->miscdev.this_device, sdsi_miscdev_remove, priv);
> + if (ret)
> + goto deregister_misc;

I think this is all you need to clean up your device memory, not the
get/put device in open/release, right?

thanks,

greg k-h

\
 
 \ /
  Last update: 2021-10-01 09:15    [W:0.112 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site