[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE_wzQ_b5QLn7Fs_YDoOXSt=c+_uJobtG=fSda84qcwWfe2fTQ@mail.gmail.com>
Date: Sat, 14 Jul 2018 11:15:00 +0300
From: Dmitry Torokhov <dtor@...omium.org>
To: toddpoynor@...il.com
Cc: rspringer@...gle.com, jnjoseph@...gle.com, benchan@...omium.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
frankhu@...omium.org, Simon Que <sque@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
devel@...verdev.osuosl.org, lkml <linux-kernel@...r.kernel.org>,
toddpoynor@...gle.com
Subject: Re: [PATCH 10/18] staging: gasket: gasket_open use container_of()
On Sat, Jul 14, 2018 at 8:58 AM Todd Poynor <toddpoynor@...il.com> wrote:
>
> From: Todd Poynor <toddpoynor@...gle.com>
>
> Use container_of(), drop unnecessary NULL check.
>
> Reported-by: Dmitry Torokhov <dtor@...omium.org>
> Signed-off-by: Zhongze Hu <frankhu@...omium.org>
> Signed-off-by: Todd Poynor <toddpoynor@...gle.com>
> ---
> drivers/staging/gasket/gasket_core.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
> index ffd6ce801313..0c45c54254fb 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -1099,12 +1099,9 @@ static int gasket_open(struct inode *inode, struct file *filp)
> const struct gasket_driver_desc *driver_desc;
> struct gasket_ownership *ownership;
> char task_name[TASK_COMM_LEN];
> - struct gasket_cdev_info *dev_info = gasket_cdev_get_info(inode->i_cdev);
Are there other users of gasket_cdev_get_info()? if this was the only
one we should remove the macro,otherwise we should convert them as
well.
> + struct gasket_cdev_info *dev_info =
> + container_of(inode->i_cdev, struct gasket_cdev_info, cdev);
>
> - if (!dev_info) {
> - gasket_nodev_error("Unable to retrieve device data");
> - return -EINVAL;
> - }
> gasket_dev = dev_info->gasket_dev_ptr;
> driver_desc = gasket_dev->internal_desc->driver_desc;
> ownership = &dev_info->ownership;
> --
> 2.18.0.203.gfac676dfb9-goog
>
Powered by blists - more mailing lists