treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / staging / uwb / ie-rcv.c
blob51a4706e0dd36d145db6389b4ad21eaffe8d1a9f
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Ultra Wide Band
4 * IE Received notification handling.
6 * Copyright (C) 2008 Cambridge Silicon Radio Ltd.
7 */
9 #include <linux/errno.h>
10 #include <linux/module.h>
11 #include <linux/device.h>
12 #include <linux/bitmap.h>
13 #include "uwb-internal.h"
16 * Process an incoming IE Received notification.
18 int uwbd_evt_handle_rc_ie_rcv(struct uwb_event *evt)
20 int result = -EINVAL;
21 struct device *dev = &evt->rc->uwb_dev.dev;
22 struct uwb_rc_evt_ie_rcv *iercv;
24 /* Is there enough data to decode it? */
25 if (evt->notif.size < sizeof(*iercv)) {
26 dev_err(dev, "IE Received notification: Not enough data to "
27 "decode (%zu vs %zu bytes needed)\n",
28 evt->notif.size, sizeof(*iercv));
29 goto error;
31 iercv = container_of(evt->notif.rceb, struct uwb_rc_evt_ie_rcv, rceb);
33 dev_dbg(dev, "IE received, element ID=%d\n", iercv->IEData[0]);
35 if (iercv->IEData[0] == UWB_RELINQUISH_REQUEST_IE) {
36 dev_warn(dev, "unhandled Relinquish Request IE\n");
39 return 0;
40 error:
41 return result;