[PATCH linux dev-4.10 v3 19/31] drivers: fsi: occ: Return ENODEV if client is NULL
Andrew Jeffery
andrew at aj.id.au
Fri Oct 6 10:05:28 AEDT 2017
On Thu, 2017-10-05 at 14:24 -0500, Eddie James wrote:
> From: "Edward A. James" <eajames at us.ibm.com>
>
> Safeguard the in-kernel api functions.
Why just the in-kernel API functions? Why not do the check in
*{read,write,release}_common()?
>
> Signed-off-by: Edward A. James <eajames at us.ibm.com>
> ---
> drivers/fsi/occ.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/fsi/occ.c b/drivers/fsi/occ.c
> index 55f293d..a551349 100644
> --- a/drivers/fsi/occ.c
> +++ b/drivers/fsi/occ.c
> @@ -654,18 +654,27 @@ struct occ_client *occ_drv_open(struct device
*dev, unsigned long flags)
>
> int occ_drv_read(struct occ_client *client, char *buf, size_t len)
> {
> + if (!client)
> + return -ENODEV;
> +
> return occ_read_common(client, NULL, buf, len);
> }
> EXPORT_SYMBOL_GPL(occ_drv_read);
>
> int occ_drv_write(struct occ_client *client, const char *buf, size_t
len)
> {
> + if (!client)
> + return -ENODEV;
> +
> return occ_write_common(client, NULL, buf, len);
> }
> EXPORT_SYMBOL_GPL(occ_drv_write);
>
> void occ_drv_release(struct occ_client *client)
> {
> + if (!client)
> + return;
> +
> occ_release_common(client);
> }
> EXPORT_SYMBOL_GPL(occ_drv_release);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20171006/3bb3cf4a/attachment-0001.sig>
More information about the openbmc
mailing list