[PATCH linux dev-4.7] drivers/fsi: Don't scan after fsi-gpio-master unbound

Joel Stanley joel at jms.id.au
Thu Mar 2 11:23:56 AEDT 2017


On Thu, Mar 2, 2017 at 8:56 AM, Christopher Bostic
<cbostic at linux.vnet.ibm.com> wrote:
> Check pointers prior to scanning master in the sysfs scan
> file.  These get invalidated after an unbind operation.
>
> Signed-off-by: Christopher Bostic <cbostic at linux.vnet.ibm.com>
> ---
>  drivers/fsi/fsi-master-gpio.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
> index c5f4f9c..67f0d9d 100644
> --- a/drivers/fsi/fsi-master-gpio.c
> +++ b/drivers/fsi/fsi-master-gpio.c
> @@ -476,7 +476,14 @@ static ssize_t store_scan(struct device *dev,
>                                 const char *buf,
>                                 size_t count)
>  {
> -       struct fsi_master_gpio *master = dev_get_drvdata(dev);
> +       struct fsi_master_gpio *master;
> +
> +       if (!dev)
> +               return count;
> +
> +       master = dev_get_drvdata(dev);
> +       if (!master)
> +               return count;

Returning count implies that you've stored the data the user has
written. You should return an error in the case where there is an
error.

Cheers,

Joel

>
>         fsi_master_gpio_init(master);
>
> --
> 1.8.2.2
>


More information about the openbmc mailing list