From be78f47e64d0484d5ce280ab7bd6da2d65479979 Mon Sep 17 00:00:00 2001 From: Jiyoung Jeong Date: Thu, 14 Jun 2018 16:21:22 +0900 Subject: [PATCH] [9610] drivers: misc: For the consistency of rx_demux logic When rx_demux call, error handling instead of higher layer function Change-Id: I319bb8642d53bc215ed9b8a6606dd3e8439a5367 Signed-off-by: Jiyoung Jeong --- drivers/misc/modem_if/modem_io_device.c | 33 +++++++++++++++++-- .../misc/modem_if/modem_link_device_shmem.c | 11 ++----- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/drivers/misc/modem_if/modem_io_device.c b/drivers/misc/modem_if/modem_io_device.c index 521a6c31a979..3974525e2f80 100644 --- a/drivers/misc/modem_if/modem_io_device.c +++ b/drivers/misc/modem_if/modem_io_device.c @@ -612,11 +612,20 @@ static int rx_frame_padding(struct io_device *iod, struct link_device *ld, static int rx_frame_done(struct io_device *iod, struct link_device *ld, struct sk_buff *skb) { + int err = 0; + /* Cut off the padding of the current frame */ skb_trim(skb, exynos_get_frame_len(skb->data)); mif_debug("%s->%s: frame length = %d\n", ld->name, iod->name, skb->len); - return rx_demux(ld, skb); + err = rx_demux(ld, skb); + if(err < 0) { + mif_err_limited("%s->%s: ERR! recv_frame_from_skb fail" + "(err %d)\n", ld->name, iod->name, err); + rx_drain(skb); + } + + return err; } static int recv_frame_from_buff(struct io_device *iod, struct link_device *ld, @@ -782,6 +791,8 @@ static int io_dev_recv_data_from_link_dev(struct io_device *iod, static int io_dev_recv_skb_from_link_dev(struct io_device *iod, struct link_device *ld, struct sk_buff *skb) { + int err = 0; + if (iod->waketime) wake_lock_timeout(&iod->wakelock, iod->waketime); @@ -789,19 +800,35 @@ static int io_dev_recv_skb_from_link_dev(struct io_device *iod, skb_trim(skb, exynos_get_frame_len(skb->data)); mif_debug("%s->%s: frame length = %d\n", ld->name, iod->name, skb->len); - return rx_demux(ld, skb); + err = rx_demux(ld, skb); + if(err < 0) { + mif_err_limited("%s->%s: ERR! recv_frame_from_skb fail" + "(err %d)\n", ld->name, iod->name, err); + rx_drain(skb); + } + + return err; } /* called from link device when a packet arrives fo this io device */ static int io_dev_recv_skb_single_from_link_dev(struct io_device *iod, struct link_device *ld, struct sk_buff *skb) { + int err = 0; + iodev_lock_wlock(iod); if (skbpriv(skb)->lnk_hdr && ld->aligned) skb_trim(skb, exynos_get_frame_len(skb->data)); - return rx_demux(ld, skb); + err = rx_demux(ld, skb); + if(err < 0) { + mif_err_limited("%s->%s: ERR! recv_frame_from_skb fail" + "(err %d)\n", ld->name, iod->name, err); + rx_drain(skb); + } + + return err; } /* inform the IO device that the modem is now online or offline or * crashing or whatever... diff --git a/drivers/misc/modem_if/modem_link_device_shmem.c b/drivers/misc/modem_if/modem_link_device_shmem.c index 956dfda7320d..f596d41f556c 100755 --- a/drivers/misc/modem_if/modem_link_device_shmem.c +++ b/drivers/misc/modem_if/modem_link_device_shmem.c @@ -582,7 +582,7 @@ static void msg_rx_work(struct work_struct *ws) struct link_device *ld; struct io_device *iod; struct sk_buff *skb; - int i, ret; + int i; int queue_len; shmd = container_of(ws, struct shmem_link_device, msg_rx_dwork.work); @@ -597,14 +597,7 @@ static void msg_rx_work(struct work_struct *ws) if (!skb) break; - ret = iod->recv_skb(iod, ld, skb); - if (unlikely(ret < 0)) { - struct modem_ctl *mc = ld->mc; - - mif_err_limited("%s: %s<-%s: %s->recv_skb fail (%d)\n", - ld->name, iod->name, mc->name, iod->name, ret); - dev_kfree_skb_any(skb); - } + iod->recv_skb(iod, ld, skb); } } } -- 2.20.1