driverdev-devel@linuxdriverproject.org

2019-08-23 Thread Mr. Ryan Roger
Good Day ,

My name is Mr. Ryan Rogers the Independent Financial Consultant. We are 
contacting you concerning funding of your business project. We are interested 
to partnership with you as we are seeking to diversify our financial portfolio 
into viable and lucrative business projects that worth it,

We are most interested in partnerships business ventures in Medical and Health 
care projects, Real estate projects, mining projects, agricultural projects 
renewable energy projects, Oil and Gas, start-up projects and business 
expansions / Loan with lower rate,

Your swift response is highly needed.

Best Regard,
Ryan Roger
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


driverdev-devel@linuxdriverproject.org

2019-08-23 Thread Mr. Ryan Roger
Good Day ,

My name is Mr. Ryan Rogers the Independent Financial Consultant. We are 
contacting you concerning funding of your business project. We are interested 
to partnership with you as we are seeking to diversify our financial portfolio 
into viable and lucrative business projects that worth it,

We are most interested in partnerships business ventures in Medical and Health 
care projects, Real estate projects, mining projects, agricultural projects 
renewable energy projects, Oil and Gas, start-up projects and business 
expansions / Loan with lower rate,

Your swift response is highly needed.

Best Regard,
Ryan Roger
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] media: imx: Move pads init to probe

2019-08-23 Thread Steve Longerbeam
If a subdevice is unregistered and then registered again without the
driver being removed and re-probed (which will happen when the media
device is removed and re-probed without also removing/re-probing the
subdevice), media_device_register_entity() is called with a non-zero
entity->num_pads, and then the subdevice's .registered callback calls
media_entity_pads_init(). Thus the subdevice's pad objects are added
to the media device pad list twice, causing list corruption.

One way to fix this would be to create media_entity_pads_destroy(),
and call it in the subdevice's .unregistered callback. But calling
media_entity_pads_init() in the .registered callbacks was done for
legacy reasons and is no longer necessary, so move the call to
media_entity_pads_init() into the subdevice's probe functions. This
fixes the duplicate pad obejcts in the media device pad list.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/imx-ic-prp.c| 25 ++--
 drivers/staging/media/imx/imx-ic-prpencvf.c   | 29 ++-
 drivers/staging/media/imx/imx-media-capture.c | 15 +-
 drivers/staging/media/imx/imx-media-csi.c | 21 +++---
 drivers/staging/media/imx/imx-media-vdic.c| 27 +++--
 drivers/staging/media/imx/imx6-mipi-csi2.c| 27 -
 drivers/staging/media/imx/imx7-media-csi.c| 18 +++-
 drivers/staging/media/imx/imx7-mipi-csis.c| 23 +--
 8 files changed, 82 insertions(+), 103 deletions(-)

diff --git a/drivers/staging/media/imx/imx-ic-prp.c 
b/drivers/staging/media/imx/imx-ic-prp.c
index 35e60a120dc1..2a4f77e83ed3 100644
--- a/drivers/staging/media/imx/imx-ic-prp.c
+++ b/drivers/staging/media/imx/imx-ic-prp.c
@@ -428,32 +428,19 @@ static int prp_s_frame_interval(struct v4l2_subdev *sd,
return 0;
 }
 
-/*
- * retrieve our pads parsed from the OF graph by the media device
- */
 static int prp_registered(struct v4l2_subdev *sd)
 {
struct prp_priv *priv = sd_to_priv(sd);
-   int i, ret;
u32 code;
 
-   for (i = 0; i < PRP_NUM_PADS; i++) {
-   priv->pad[i].flags = (i == PRP_SINK_PAD) ?
-   MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
-   }
-
/* init default frame interval */
priv->frame_interval.numerator = 1;
priv->frame_interval.denominator = 30;
 
/* set a default mbus format  */
imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV);
-   ret = imx_media_init_mbus_fmt(&priv->format_mbus, 640, 480, code,
- V4L2_FIELD_NONE, NULL);
-   if (ret)
-   return ret;
-
-   return media_entity_pads_init(&sd->entity, PRP_NUM_PADS, priv->pad);
+   return imx_media_init_mbus_fmt(&priv->format_mbus, 640, 480, code,
+  V4L2_FIELD_NONE, NULL);
 }
 
 static const struct v4l2_subdev_pad_ops prp_pad_ops = {
@@ -487,6 +474,7 @@ static const struct v4l2_subdev_internal_ops 
prp_internal_ops = {
 static int prp_init(struct imx_ic_priv *ic_priv)
 {
struct prp_priv *priv;
+   int i;
 
priv = devm_kzalloc(ic_priv->ipu_dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -496,7 +484,12 @@ static int prp_init(struct imx_ic_priv *ic_priv)
ic_priv->task_priv = priv;
priv->ic_priv = ic_priv;
 
-   return 0;
+   for (i = 0; i < PRP_NUM_PADS; i++)
+   priv->pad[i].flags = (i == PRP_SINK_PAD) ?
+   MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
+
+   return media_entity_pads_init(&ic_priv->sd.entity, PRP_NUM_PADS,
+ priv->pad);
 }
 
 static void prp_remove(struct imx_ic_priv *ic_priv)
diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index 301f5fce53c0..09c4e3f33807 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -1240,21 +1240,16 @@ static int prp_s_frame_interval(struct v4l2_subdev *sd,
return 0;
 }
 
-/*
- * retrieve our pads parsed from the OF graph by the media device
- */
 static int prp_registered(struct v4l2_subdev *sd)
 {
struct prp_priv *priv = sd_to_priv(sd);
+   struct imx_ic_priv *ic_priv = priv->ic_priv;
int i, ret;
u32 code;
 
+   /* set a default mbus format  */
+   imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV);
for (i = 0; i < PRPENCVF_NUM_PADS; i++) {
-   priv->pad[i].flags = (i == PRPENCVF_SINK_PAD) ?
-   MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
-
-   /* set a default mbus format  */
-   imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV);
ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
  640, 480, code, V4L2_FIELD_NONE,
  &priv->cc[i]);
@@ -1266,11 +1261,6 @@ static int prp_registered(struct v4l2_subd

[PATCH 1/2] media: imx: Move capture device init to registered

2019-08-23 Thread Steve Longerbeam
If the CSI is unregistered and then registered again without the
driver being removed and re-probed (which will happen when the media
device is removed and re-probed without also removing/re-probing the
CSI), the result is the kobject error and backtrace "tried to init an
initialized object". This is because the video device is left in an
initialized state after being unregistered, thus the video device's
underlying kobject is also left in an initialized state when the device
is registered again.

Fix this by moving imx_media_capture_device_init() and _remove()
into csi_registered() and csi_unregistered(). This will create a new
un-initialized video device when the CSI is re-registered. Do this for
all the subdevices that register a capture device.

Reported-by: Russell King 
Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 24 -
 drivers/staging/media/imx/imx-media-csi.c   | 20 ++---
 drivers/staging/media/imx/imx7-media-csi.c  | 22 +--
 3 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index 67ffa46a8e96..301f5fce53c0 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -1271,17 +1271,26 @@ static int prp_registered(struct v4l2_subdev *sd)
if (ret)
return ret;
 
+   priv->vdev = imx_media_capture_device_init(ic_priv->ipu_dev,
+  &ic_priv->sd,
+  PRPENCVF_SRC_PAD);
+   if (IS_ERR(priv->vdev))
+   return PTR_ERR(priv->vdev);
+
ret = imx_media_capture_device_register(priv->vdev);
if (ret)
-   return ret;
+   goto remove_vdev;
 
ret = prp_init_controls(priv);
if (ret)
-   goto unreg;
+   goto unreg_vdev;
 
return 0;
-unreg:
+
+unreg_vdev:
imx_media_capture_device_unregister(priv->vdev);
+remove_vdev:
+   imx_media_capture_device_remove(priv->vdev);
return ret;
 }
 
@@ -1290,6 +1299,8 @@ static void prp_unregistered(struct v4l2_subdev *sd)
struct prp_priv *priv = sd_to_priv(sd);
 
imx_media_capture_device_unregister(priv->vdev);
+   imx_media_capture_device_remove(priv->vdev);
+
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
 }
 
@@ -1336,12 +1347,6 @@ static int prp_init(struct imx_ic_priv *ic_priv)
spin_lock_init(&priv->irqlock);
timer_setup(&priv->eof_timeout_timer, prp_eof_timeout, 0);
 
-   priv->vdev = imx_media_capture_device_init(ic_priv->ipu_dev,
-  &ic_priv->sd,
-  PRPENCVF_SRC_PAD);
-   if (IS_ERR(priv->vdev))
-   return PTR_ERR(priv->vdev);
-
mutex_init(&priv->lock);
 
return 0;
@@ -1352,7 +1357,6 @@ static void prp_remove(struct imx_ic_priv *ic_priv)
struct prp_priv *priv = ic_priv->task_priv;
 
mutex_destroy(&priv->lock);
-   imx_media_capture_device_remove(priv->vdev);
 }
 
 struct imx_ic_ops imx_ic_prpencvf_ops = {
diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 367e39f5b382..b3f1cf08a102 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -1797,12 +1797,22 @@ static int csi_registered(struct v4l2_subdev *sd)
if (ret)
goto free_fim;
 
+   priv->vdev = imx_media_capture_device_init(priv->sd.dev,
+  &priv->sd,
+  CSI_SRC_PAD_IDMAC);
+   if (IS_ERR(priv->vdev)) {
+   ret = PTR_ERR(priv->vdev);
+   goto free_fim;
+   }
+
ret = imx_media_capture_device_register(priv->vdev);
if (ret)
-   goto free_fim;
+   goto remove_vdev;
 
return 0;
 
+remove_vdev:
+   imx_media_capture_device_remove(priv->vdev);
 free_fim:
if (priv->fim)
imx_media_fim_free(priv->fim);
@@ -1816,6 +1826,7 @@ static void csi_unregistered(struct v4l2_subdev *sd)
struct csi_priv *priv = v4l2_get_subdevdata(sd);
 
imx_media_capture_device_unregister(priv->vdev);
+   imx_media_capture_device_remove(priv->vdev);
 
if (priv->fim)
imx_media_fim_free(priv->fim);
@@ -1963,11 +1974,6 @@ static int imx_csi_probe(struct platform_device *pdev)
imx_media_grp_id_to_sd_name(priv->sd.name, sizeof(priv->sd.name),
priv->sd.grp_id, ipu_get_num(priv->ipu));
 
-   priv->vdev = imx_media_capture_device_init(priv->sd.dev, &priv->sd,
-  CSI_SRC_PAD_IDMAC);
-   if (IS_ERR(priv->vdev))
-   return 

Re: [PATCH v2 5/7] media: use the BIT() macro

2019-08-23 Thread Laurent Pinchart
Hi Mauro,

Thank you for the patch.

On Fri, Aug 23, 2019 at 06:47:30AM -0300, Mauro Carvalho Chehab wrote:
> As warned by cppcheck:
> 
>   [drivers/media/dvb-frontends/cx24123.c:434]: (error) Shifting signed 
> 32-bit value by 31 bits is undefined behaviour
>   [drivers/media/pci/bt8xx/bttv-input.c:87]: (error) Shifting signed 
> 32-bit value by 31 bits is undefined behaviour
>   [drivers/media/pci/bt8xx/bttv-input.c:98]: (error) Shifting signed 
> 32-bit value by 31 bits is undefined behaviour
>   ...
>   [drivers/media/v4l2-core/v4l2-ioctl.c:1391]: (error) Shifting signed 
> 32-bit value by 31 bits is undefined behaviour
> 
> There are lots of places where we're doing 1 << 31. That's bad,
> as, depending on the architecture, this has an undefined behavior.
> 
> The BIT() macro is already prepared to handle this, so, let's
> just switch all "1 << number" macros by BIT(number) at the header files
> with has 1 << 31.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
> 
> v2: 
>   As suggested by Laurent:
>  - Don't touch multi-bit masks
>  - remove explicit casts
> 
>  drivers/media/pci/cobalt/cobalt-driver.h  |  63 +-
>  drivers/media/pci/ivtv/ivtv-irq.h |  28 +-
>  drivers/media/pci/mantis/mantis_reg.h | 152 ++---
>  drivers/media/pci/solo6x10/solo6x10-regs.h| 286 -
>  .../media/platform/am437x/am437x-vpfe_regs.h  |  26 +-
>  .../media/platform/davinci/dm644x_ccdc_regs.h |  20 +-
>  .../media/platform/exynos4-is/fimc-lite-reg.h |  80 +--
>  drivers/media/platform/exynos4-is/fimc-reg.h  | 138 +++--
>  drivers/media/platform/omap3isp/ispreg.h  | 580 +-
>  drivers/media/platform/s3c-camif/camif-regs.h | 118 ++--
>  drivers/media/platform/tegra-cec/tegra_cec.h  |  80 +--
>  drivers/media/platform/ti-vpe/vpe_regs.h  |  94 +--
>  drivers/media/platform/vsp1/vsp1_regs.h   | 224 +++
>  drivers/media/platform/xilinx/xilinx-vip.h|  29 +-
>  drivers/media/radio/wl128x/fmdrv_common.h |  88 +--
>  drivers/staging/media/ipu3/ipu3-tables.h  |   4 +-
>  16 files changed, 1011 insertions(+), 999 deletions(-)

[snip]

> diff --git a/drivers/media/platform/omap3isp/ispreg.h 
> b/drivers/media/platform/omap3isp/ispreg.h
> index 38e2b99b3f10..4c6ebc0b74d1 100644
> --- a/drivers/media/platform/omap3isp/ispreg.h
> +++ b/drivers/media/platform/omap3isp/ispreg.h

[snip]

> @@ -1167,14 +1167,14 @@
>  #define ISPHIST_HV_INFO_MASK 0x3FFF3FFF
>  
>  #define ISPCCDC_LSC_ENABLE   1

This is a bit too, it could be replaced with BIT(0).

> -#define ISPCCDC_LSC_BUSY (1 << 7)
> +#define ISPCCDC_LSC_BUSY BIT(7)
>  #define ISPCCDC_LSC_GAIN_MODE_N_MASK 0x700
>  #define ISPCCDC_LSC_GAIN_MODE_N_SHIFT8
>  #define ISPCCDC_LSC_GAIN_MODE_M_MASK 0x3800
>  #define ISPCCDC_LSC_GAIN_MODE_M_SHIFT12
>  #define ISPCCDC_LSC_GAIN_FORMAT_MASK 0xE
>  #define ISPCCDC_LSC_GAIN_FORMAT_SHIFT1
> -#define ISPCCDC_LSC_AFTER_REFORMATTER_MASK   (1<<6)
> +#define ISPCCDC_LSC_AFTER_REFORMATTER_MASK   BIT(6)
>  
>  #define ISPCCDC_LSC_INITIAL_X_MASK   0x3F
>  #define ISPCCDC_LSC_INITIAL_X_SHIFT  0

[snip]

With this small issue addressed,

For omap3isp, vsp1, xilinx, wl128x and ipu3,

Reviewed-by: Laurent Pinchart 

-- 
Regards,

Laurent Pinchart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: staging: vt6656: Use common error handling code in vnt_alloc_bufs()

2019-08-23 Thread Markus Elfring
 Your patch remove redundant code, which is fine.

Thanks for your constructive feedback.


> code you changed was simple enough to be understand quickly. I think replacing
> it with a crossed goto (even if it remove redundant code) might not be the 
> best
> option.
>
> A solution might be to move the second loop to the top of the function

I am unsure about the relevance of the loop ordering for the affected
resource allocations.


> so you should be able to replace the end of the cleanup calls with:
>
> enomem:
>   ret = -ENOMEM;
> free_rx:
>   vnt_free_rx_bufs(priv);
>   return ret;

The exception handling can eventually adjusted another bit according
to your refactoring.


> This way, only a failed call to vnt_submit_rx_urb() should jump to free_rx,

It seems that a goto statement will still be needed in an error code
part by both discussed variants.


> another failed call should jump to enomem or previously defined
> label, so we can correctly forward errors.

This view sounds promising.


> With such solution it might be worth adding a comment to describe
> that all error should be ENOMEM except for vnt_submit_rx_urb().

Can this function implementation become clearer also without
such a comment?

Regards,
Markus
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8192u: remove code under TO_DO_LIST

2019-08-23 Thread Stephen Brennan
Several blocks of code are guarded by #ifdef TO_DO_LIST. If this is
defined, compilation fails. No machinery exists to define this, and no
documenation on the in-progress feature exists. Since this code is dead,
let's delete it.

Signed-off-by: Stephen Brennan 
---

Sorry, I know you're giving a keynote right now Greg :)

 .../staging/rtl8192u/ieee80211/ieee80211.h|   2 -
 .../staging/rtl8192u/ieee80211/ieee80211_tx.c |  21 
 .../rtl8192u/ieee80211/rtl819x_HTProc.c   |   4 -
 .../rtl8192u/ieee80211/rtl819x_TSProc.c   |   4 -
 drivers/staging/rtl8192u/r8192U_core.c| 101 +-
 drivers/staging/rtl8192u/r819xU_phy.c |  59 --
 6 files changed, 4 insertions(+), 187 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index daebbbd8f4dd..9576b647f6b1 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -1649,10 +1649,8 @@ struct ieee80211_device {
struct list_headRx_TS_Pending_List;
struct list_headRx_TS_Unused_List;
struct rx_ts_record RxTsRecord[TOTAL_TS_NUM];
-//#ifdef TO_DO_LIST
struct rx_reorder_entry RxReorderEntry[128];
struct list_headRxReorder_Unused_List;
-//#endif
// Qos related. Added by Annie, 2005-11-01.
 // PSTA_QOSpStaQos;
u8  ForcedPriority; // Force 
per-packet priority 1~7. (default: 0, not to force it.)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
index e76bdedc8409..140e3cb66a2e 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
@@ -302,13 +302,6 @@ static void ieee80211_tx_query_agg_cap(struct 
ieee80211_device *ieee,
if (is_multicast_ether_addr(hdr->addr1))
return;
//check packet and mode later
-#ifdef TO_DO_LIST
-   if (pTcb->PacketLength >= 4096)
-   return;
-   // For RTL819X, if pairwisekey = wep/tkip, we don't aggrregation.
-   if (!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter))
-   return;
-#endif
if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) {
return;
}
@@ -509,20 +502,6 @@ static void ieee80211_query_protectionmode(struct 
ieee80211_device *ieee,
 static void ieee80211_txrate_selectmode(struct ieee80211_device *ieee,
struct cb_desc *tcb_desc)
 {
-#ifdef TO_DO_LIST
-   if (!IsDataFrame(pFrame)) {
-   pTcb->bTxDisableRateFallBack = true;
-   pTcb->bTxUseDriverAssingedRate = true;
-   pTcb->RATRIndex = 7;
-   return;
-   }
-
-   if (pMgntInfo->ForcedDataRate != 0) {
-   pTcb->bTxDisableRateFallBack = true;
-   pTcb->bTxUseDriverAssingedRate = true;
-   return;
-   }
-#endif
if (ieee->bTxDisableRateFallBack)
tcb_desc->bTxDisableRateFallBack = true;
 
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index c73a8058cf87..dba3f2db9f48 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -93,10 +93,6 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
ieee->bTxDisableRateFallBack = 0;
ieee->bTxUseDriverAssingedRate = 0;
 
-#ifdef TO_DO_LIST
-   // 8190 only. Assign duration operation mode to firmware
-   pMgntInfo->bTxEnableFwCalcDur = 
(BOOLEAN)pNdisCommon->bRegTxEnableFwCalcDur;
-#endif
/*
 * 8190 only, Realtek proprietary aggregation mode
 * Set MPDUDensity=2,   1: Set MPDUDensity=2(32k)  for Realtek AP and 
set MPDUDensity=0(8k) for others
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
index f4e5aa07421f..5cee1031a27c 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
@@ -180,14 +180,12 @@ void TSInitialize(struct ieee80211_device *ieee)
}
// Initialize unused Rx Reorder List.
INIT_LIST_HEAD(&ieee->RxReorder_Unused_List);
-//#ifdef TO_DO_LIST
for (count = 0; count < REORDER_ENTRY_NUM; count++) {
list_add_tail(&pRxReorderEntry->List, 
&ieee->RxReorder_Unused_List);
if (count == (REORDER_ENTRY_NUM - 1))
break;
pRxReorderEntry = &ieee->RxReorderEntry[count + 1];
}
-//#endif
 }
 
 static void AdmitTS(struct ieee80211_device *ieee,
@@ -417,7 +415,6 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, 
struct ts_common_info *
TsInitDelBA(ieee, pTs, TxRxSelect);

Re: [PATCH] staging: vt6656: Use common error handling code in vnt_alloc_bufs()

2019-08-23 Thread Quentin Deslandes
On Fri, Aug 23, 2019 at 03:30:11PM +0200, Markus Elfring wrote:
> From: Markus Elfring 
> Date: Fri, 23 Aug 2019 15:15:41 +0200
> 
> Adjust jump targets so that a bit of exception handling can be better
> reused at the end of this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring 
> ---
>  drivers/staging/vt6656/main_usb.c | 46 +--
>  1 file changed, 19 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/main_usb.c 
> b/drivers/staging/vt6656/main_usb.c
> index 856ba97aec4f..d9f14da37bbc 100644
> --- a/drivers/staging/vt6656/main_usb.c
> +++ b/drivers/staging/vt6656/main_usb.c
> @@ -443,10 +443,8 @@ static int vnt_alloc_bufs(struct vnt_private *priv)
> 
>   for (ii = 0; ii < priv->num_tx_context; ii++) {
>   tx_context = kmalloc(sizeof(*tx_context), GFP_KERNEL);
> - if (!tx_context) {
> - ret = -ENOMEM;
> - goto free_tx;
> - }
> + if (!tx_context)
> + goto e_nomem_tx;
> 
>   priv->tx_context[ii] = tx_context;
>   tx_context->priv = priv;
> @@ -454,20 +452,16 @@ static int vnt_alloc_bufs(struct vnt_private *priv)
> 
>   /* allocate URBs */
>   tx_context->urb = usb_alloc_urb(0, GFP_KERNEL);
> - if (!tx_context->urb) {
> - ret = -ENOMEM;
> - goto free_tx;
> - }
> + if (!tx_context->urb)
> + goto e_nomem_tx;
> 
>   tx_context->in_use = false;
>   }
> 
>   for (ii = 0; ii < priv->num_rcb; ii++) {
>   priv->rcb[ii] = kzalloc(sizeof(*priv->rcb[ii]), GFP_KERNEL);
> - if (!priv->rcb[ii]) {
> - ret = -ENOMEM;
> - goto free_rx_tx;
> - }
> + if (!priv->rcb[ii])
> + goto e_nomem_rx;
> 
>   rcb = priv->rcb[ii];
> 
> @@ -475,16 +469,12 @@ static int vnt_alloc_bufs(struct vnt_private *priv)
> 
>   /* allocate URBs */
>   rcb->urb = usb_alloc_urb(0, GFP_KERNEL);
> - if (!rcb->urb) {
> - ret = -ENOMEM;
> - goto free_rx_tx;
> - }
> + if (!rcb->urb)
> + goto e_nomem_rx;
> 
>   rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
> - if (!rcb->skb) {
> - ret = -ENOMEM;
> - goto free_rx_tx;
> - }
> + if (!rcb->skb)
> + goto e_nomem_rx;
> 
>   rcb->in_use = false;
> 
> @@ -495,21 +485,23 @@ static int vnt_alloc_bufs(struct vnt_private *priv)
>   }
> 
>   priv->interrupt_urb = usb_alloc_urb(0, GFP_KERNEL);
> - if (!priv->interrupt_urb) {
> - ret = -ENOMEM;
> - goto free_rx_tx;
> - }
> + if (!priv->interrupt_urb)
> + goto e_nomem_rx;
> 
>   priv->int_buf.data_buf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL);
> - if (!priv->int_buf.data_buf) {
> - ret = -ENOMEM;
> + if (!priv->int_buf.data_buf)
>   goto free_rx_tx_urb;
> - }
> 
>   return 0;
> 
> +e_nomem_tx:
> + ret = -ENOMEM;
> + goto free_tx;
> +
>  free_rx_tx_urb:
>   usb_free_urb(priv->interrupt_urb);
> +e_nomem_rx:
> + ret = -ENOMEM;
>  free_rx_tx:
>   vnt_free_rx_bufs(priv);
>  free_tx:
> --
> 2.23.0
> 

Your patch remove redundant code, which is fine. However, and IMHO, the
code you changed was simple enough to be understand quickly. I think replacing
it with a crossed goto (even if it remove redundant code) might not be the best
option.

A solution might be to move the second loop to the top of the function so
you should be able to replace the end of the cleanup calls with:

enomem:
ret = -ENOMEM;
free_rx:
vnt_free_rx_bufs(priv);
return ret;

This way, only a failed call to vnt_submit_rx_urb() should jump to
free_rx, another failed call should jump to enomem or previously defined
label, so we can correctly forward errors. With such solution it might
be worth adding a comment to describe that all error should be ENOMEM
except for vnt_submit_rx_urb(). Does that looks good to you?

Regards,
Quentin
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vt6656: Use common error handling code in vnt_alloc_bufs()

2019-08-23 Thread Markus Elfring
From: Markus Elfring 
Date: Fri, 23 Aug 2019 15:15:41 +0200

Adjust jump targets so that a bit of exception handling can be better
reused at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/staging/vt6656/main_usb.c | 46 +--
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index 856ba97aec4f..d9f14da37bbc 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -443,10 +443,8 @@ static int vnt_alloc_bufs(struct vnt_private *priv)

for (ii = 0; ii < priv->num_tx_context; ii++) {
tx_context = kmalloc(sizeof(*tx_context), GFP_KERNEL);
-   if (!tx_context) {
-   ret = -ENOMEM;
-   goto free_tx;
-   }
+   if (!tx_context)
+   goto e_nomem_tx;

priv->tx_context[ii] = tx_context;
tx_context->priv = priv;
@@ -454,20 +452,16 @@ static int vnt_alloc_bufs(struct vnt_private *priv)

/* allocate URBs */
tx_context->urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!tx_context->urb) {
-   ret = -ENOMEM;
-   goto free_tx;
-   }
+   if (!tx_context->urb)
+   goto e_nomem_tx;

tx_context->in_use = false;
}

for (ii = 0; ii < priv->num_rcb; ii++) {
priv->rcb[ii] = kzalloc(sizeof(*priv->rcb[ii]), GFP_KERNEL);
-   if (!priv->rcb[ii]) {
-   ret = -ENOMEM;
-   goto free_rx_tx;
-   }
+   if (!priv->rcb[ii])
+   goto e_nomem_rx;

rcb = priv->rcb[ii];

@@ -475,16 +469,12 @@ static int vnt_alloc_bufs(struct vnt_private *priv)

/* allocate URBs */
rcb->urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!rcb->urb) {
-   ret = -ENOMEM;
-   goto free_rx_tx;
-   }
+   if (!rcb->urb)
+   goto e_nomem_rx;

rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
-   if (!rcb->skb) {
-   ret = -ENOMEM;
-   goto free_rx_tx;
-   }
+   if (!rcb->skb)
+   goto e_nomem_rx;

rcb->in_use = false;

@@ -495,21 +485,23 @@ static int vnt_alloc_bufs(struct vnt_private *priv)
}

priv->interrupt_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!priv->interrupt_urb) {
-   ret = -ENOMEM;
-   goto free_rx_tx;
-   }
+   if (!priv->interrupt_urb)
+   goto e_nomem_rx;

priv->int_buf.data_buf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL);
-   if (!priv->int_buf.data_buf) {
-   ret = -ENOMEM;
+   if (!priv->int_buf.data_buf)
goto free_rx_tx_urb;
-   }

return 0;

+e_nomem_tx:
+   ret = -ENOMEM;
+   goto free_tx;
+
 free_rx_tx_urb:
usb_free_urb(priv->interrupt_urb);
+e_nomem_rx:
+   ret = -ENOMEM;
 free_rx_tx:
vnt_free_rx_bufs(priv);
 free_tx:
--
2.23.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 5/7] media: use the BIT() macro

2019-08-23 Thread Benoit Parrot
Mauro Carvalho Chehab  wrote on Fri [2019-Aug-23 
06:47:30 -0300]:
> As warned by cppcheck:
> 
>   [drivers/media/dvb-frontends/cx24123.c:434]: (error) Shifting signed 
> 32-bit value by 31 bits is undefined behaviour
>   [drivers/media/pci/bt8xx/bttv-input.c:87]: (error) Shifting signed 
> 32-bit value by 31 bits is undefined behaviour
>   [drivers/media/pci/bt8xx/bttv-input.c:98]: (error) Shifting signed 
> 32-bit value by 31 bits is undefined behaviour
>   ...
>   [drivers/media/v4l2-core/v4l2-ioctl.c:1391]: (error) Shifting signed 
> 32-bit value by 31 bits is undefined behaviour
> 
> There are lots of places where we're doing 1 << 31. That's bad,
> as, depending on the architecture, this has an undefined behavior.
> 
> The BIT() macro is already prepared to handle this, so, let's
> just switch all "1 << number" macros by BIT(number) at the header files
> with has 1 << 31.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
> 
> v2: 
>   As suggested by Laurent:
>  - Don't touch multi-bit masks
>  - remove explicit casts
> 
For:
drivers/media/platform/am437x/am437x-vpfe_regs.h
drivers/media/platform/ti-vpe/vpe_regs.h

Reviewed-by: Benoit Parrot 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 5/7] media: use the BIT() macro

2019-08-23 Thread Sylwester Nawrocki
On 8/23/19 11:47, Mauro Carvalho Chehab wrote:
> There are lots of places where we're doing 1 << 31. That's bad,
> as, depending on the architecture, this has an undefined behavior.
> 
> The BIT() macro is already prepared to handle this, so, let's
> just switch all "1 << number" macros by BIT(number) at the header files
> with has 1 << 31.
> 
> Signed-off-by: Mauro Carvalho Chehab 

> v2: 
>   As suggested by Laurent:
>  - Don't touch multi-bit masks
>  - remove explicit casts

For:
  drivers/media/platform/exynos4-is/fimc-lite-reg.h
  drivers/media/platform/exynos4-is/fimc-reg.h
  drivers/media/platform/s3c-camif/camif-regs.h

Reviewed-by: Sylwester Nawrocki 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 5/7] media: use the BIT() macro

2019-08-23 Thread Mauro Carvalho Chehab
As warned by cppcheck:

[drivers/media/dvb-frontends/cx24123.c:434]: (error) Shifting signed 
32-bit value by 31 bits is undefined behaviour
[drivers/media/pci/bt8xx/bttv-input.c:87]: (error) Shifting signed 
32-bit value by 31 bits is undefined behaviour
[drivers/media/pci/bt8xx/bttv-input.c:98]: (error) Shifting signed 
32-bit value by 31 bits is undefined behaviour
...
[drivers/media/v4l2-core/v4l2-ioctl.c:1391]: (error) Shifting signed 
32-bit value by 31 bits is undefined behaviour

There are lots of places where we're doing 1 << 31. That's bad,
as, depending on the architecture, this has an undefined behavior.

The BIT() macro is already prepared to handle this, so, let's
just switch all "1 << number" macros by BIT(number) at the header files
with has 1 << 31.

Signed-off-by: Mauro Carvalho Chehab 
---

v2: 
  As suggested by Laurent:
 - Don't touch multi-bit masks
 - remove explicit casts

 drivers/media/pci/cobalt/cobalt-driver.h  |  63 +-
 drivers/media/pci/ivtv/ivtv-irq.h |  28 +-
 drivers/media/pci/mantis/mantis_reg.h | 152 ++---
 drivers/media/pci/solo6x10/solo6x10-regs.h| 286 -
 .../media/platform/am437x/am437x-vpfe_regs.h  |  26 +-
 .../media/platform/davinci/dm644x_ccdc_regs.h |  20 +-
 .../media/platform/exynos4-is/fimc-lite-reg.h |  80 +--
 drivers/media/platform/exynos4-is/fimc-reg.h  | 138 +++--
 drivers/media/platform/omap3isp/ispreg.h  | 580 +-
 drivers/media/platform/s3c-camif/camif-regs.h | 118 ++--
 drivers/media/platform/tegra-cec/tegra_cec.h  |  80 +--
 drivers/media/platform/ti-vpe/vpe_regs.h  |  94 +--
 drivers/media/platform/vsp1/vsp1_regs.h   | 224 +++
 drivers/media/platform/xilinx/xilinx-vip.h|  29 +-
 drivers/media/radio/wl128x/fmdrv_common.h |  88 +--
 drivers/staging/media/ipu3/ipu3-tables.h  |   4 +-
 16 files changed, 1011 insertions(+), 999 deletions(-)

diff --git a/drivers/media/pci/cobalt/cobalt-driver.h 
b/drivers/media/pci/cobalt/cobalt-driver.h
index 429bee4ef79c..bca68572b324 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.h
+++ b/drivers/media/pci/cobalt/cobalt-driver.h
@@ -11,6 +11,7 @@
 #ifndef COBALT_DRIVER_H
 #define COBALT_DRIVER_H
 
+#include 
 #include 
 #include 
 #include 
@@ -61,37 +62,37 @@
 #define COBALT_CLK 5000
 
 /* System status register */
-#define COBALT_SYSSTAT_DIP0_MSK(1 << 0)
-#define COBALT_SYSSTAT_DIP1_MSK(1 << 1)
-#define COBALT_SYSSTAT_HSMA_PRSNTN_MSK (1 << 2)
-#define COBALT_SYSSTAT_FLASH_RDYBSYN_MSK   (1 << 3)
-#define COBALT_SYSSTAT_VI0_5V_MSK  (1 << 4)
-#define COBALT_SYSSTAT_VI0_INT1_MSK(1 << 5)
-#define COBALT_SYSSTAT_VI0_INT2_MSK(1 << 6)
-#define COBALT_SYSSTAT_VI0_LOST_DATA_MSK   (1 << 7)
-#define COBALT_SYSSTAT_VI1_5V_MSK  (1 << 8)
-#define COBALT_SYSSTAT_VI1_INT1_MSK(1 << 9)
-#define COBALT_SYSSTAT_VI1_INT2_MSK(1 << 10)
-#define COBALT_SYSSTAT_VI1_LOST_DATA_MSK   (1 << 11)
-#define COBALT_SYSSTAT_VI2_5V_MSK  (1 << 12)
-#define COBALT_SYSSTAT_VI2_INT1_MSK(1 << 13)
-#define COBALT_SYSSTAT_VI2_INT2_MSK(1 << 14)
-#define COBALT_SYSSTAT_VI2_LOST_DATA_MSK   (1 << 15)
-#define COBALT_SYSSTAT_VI3_5V_MSK  (1 << 16)
-#define COBALT_SYSSTAT_VI3_INT1_MSK(1 << 17)
-#define COBALT_SYSSTAT_VI3_INT2_MSK(1 << 18)
-#define COBALT_SYSSTAT_VI3_LOST_DATA_MSK   (1 << 19)
-#define COBALT_SYSSTAT_VIHSMA_5V_MSK   (1 << 20)
-#define COBALT_SYSSTAT_VIHSMA_INT1_MSK (1 << 21)
-#define COBALT_SYSSTAT_VIHSMA_INT2_MSK (1 << 22)
-#define COBALT_SYSSTAT_VIHSMA_LOST_DATA_MSK(1 << 23)
-#define COBALT_SYSSTAT_VOHSMA_INT1_MSK (1 << 24)
-#define COBALT_SYSSTAT_VOHSMA_PLL_LOCKED_MSK   (1 << 25)
-#define COBALT_SYSSTAT_VOHSMA_LOST_DATA_MSK(1 << 26)
-#define COBALT_SYSSTAT_AUD_PLL_LOCKED_MSK  (1 << 28)
-#define COBALT_SYSSTAT_AUD_IN_LOST_DATA_MSK(1 << 29)
-#define COBALT_SYSSTAT_AUD_OUT_LOST_DATA_MSK   (1 << 30)
-#define COBALT_SYSSTAT_PCIE_SMBCLK_MSK (1 << 31)
+#define COBALT_SYSSTAT_DIP0_MSKBIT(0)
+#define COBALT_SYSSTAT_DIP1_MSKBIT(1)
+#define COBALT_SYSSTAT_HSMA_PRSNTN_MSK BIT(2)
+#define COBALT_SYSSTAT_FLASH_RDYBSYN_MSK   BIT(3)
+#define COBALT_SYSSTAT_VI0_5V_MSK  BIT(4)
+#define COBALT_SYSSTAT_VI0_INT1_MSKBIT(5)
+#define COBALT_SYSSTAT_VI0_INT2_MSKBIT(6)
+#define COBALT_SYSSTAT_VI0_LOST_DATA_MSK   BIT(7)
+#define COBALT_SYSSTAT_VI1_5V_MSK  BIT(8)
+#define COBALT_SYSSTAT_VI1_INT1_MSKBIT(9)
+#define COBALT_SYSSTAT_VI1_INT2_MSKBIT(10)
+#define COBALT_SYSSTAT_VI1_LOST_DATA_MSK   BIT(11)
+#define COBALT_SYSSTAT_VI2_5V_MSK  BIT(12)
+#define COBALT_SYSSTAT_VI2_INT1_MSKBIT(13)

Dodatečné zdroje

2019-08-23 Thread Kamil Adamec
Dobrý den!

Živnostníkům často stojí v cestě k dosažení úspěchu nízká úroveň provozních 
zdrojů na nákup materiálu, zboží nebo surovin z důvodu např. nezaplacení faktur 
(nezaplacení od dodavatelů, prodloužená splatnost apod.). V této oblasti jsme 
již pomohli řadě firem, které mohly díky získání návratného financování 
realizovat své klíčové plány.

Jsem partnerem mnoha společností, jejichž činnost je srovnatelná s tou Vaší a 
za kooperaci s námi získáte bonus - rychlé splacení ve výši až 4 splátek.

Dovolte, abychom Vás kontaktovali za účelem provedení analýzy možností pomoci 
financování. Kdy bych mohl zavolat?


S pozdravem
Kamil Adamec
Account Manager
www.automatics-control.eu
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Dodatečné zdroje

2019-08-23 Thread Kamil Adamec
Dobrý den!

Živnostníkům často stojí v cestě k dosažení úspěchu nízká úroveň provozních 
zdrojů na nákup materiálu, zboží nebo surovin z důvodu např. nezaplacení faktur 
(nezaplacení od dodavatelů, prodloužená splatnost apod.). V této oblasti jsme 
již pomohli řadě firem, které mohly díky získání návratného financování 
realizovat své klíčové plány.

Jsem partnerem mnoha společností, jejichž činnost je srovnatelná s tou Vaší a 
za kooperaci s námi získáte bonus - rychlé splacení ve výši až 4 splátek.

Dovolte, abychom Vás kontaktovali za účelem provedení analýzy možností pomoci 
financování. Kdy bych mohl zavolat?


S pozdravem
Kamil Adamec
Account Manager
www.automatics-control.eu
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Dodatečné zdroje

2019-08-23 Thread Kamil Adamec
Dobrý den!

Živnostníkům často stojí v cestě k dosažení úspěchu nízká úroveň provozních 
zdrojů na nákup materiálu, zboží nebo surovin z důvodu např. nezaplacení faktur 
(nezaplacení od dodavatelů, prodloužená splatnost apod.). V této oblasti jsme 
již pomohli řadě firem, které mohly díky získání návratného financování 
realizovat své klíčové plány.

Jsem partnerem mnoha společností, jejichž činnost je srovnatelná s tou Vaší a 
za kooperaci s námi získáte bonus - rychlé splacení ve výši až 4 splátek.

Dovolte, abychom Vás kontaktovali za účelem provedení analýzy možností pomoci 
financování. Kdy bych mohl zavolat?


S pozdravem
Kamil Adamec
Account Manager
www.automatics-control.eu
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel