lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 27 Jul 2022 10:06:47 +0000
From:   "Cao, Bingbu" <bingbu.cao@...el.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     "Qiu, Tian Shu" <tian.shu.qiu@...el.com>,
        "Tu, ShawnX" <shawnx.tu@...el.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>
Subject: RE: [PATCH v1 6/8] media: ov2740: Switch to use dev_err_probe()

Reviewed-by: Bingbu Cao <bingbu.cao@...el.com>
________________________
BRs,  
Bingbu Cao 

> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Sent: Tuesday, July 26, 2022 8:06 PM
> To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>; linux-
> media@...r.kernel.org; linux-kernel@...r.kernel.org
> Cc: Qiu, Tian Shu <tian.shu.qiu@...el.com>; Tu, ShawnX
> <shawnx.tu@...el.com>; Cao, Bingbu <bingbu.cao@...el.com>; Mauro Carvalho
> Chehab <mchehab@...nel.org>
> Subject: [PATCH v1 6/8] media: ov2740: Switch to use dev_err_probe()
> 
> Switch to use dev_err_probe() to simpify error path and unify message
> template.
> 
> While at it, add missed \n to the end of the messages.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/media/i2c/ov2740.c | 44 ++++++++++++++++----------------------
>  1 file changed, 19 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index
> 212190cb14e4..7271e3d011c9 100644
> --- a/drivers/media/i2c/ov2740.c
> +++ b/drivers/media/i2c/ov2740.c
> @@ -1013,10 +1013,10 @@ static int ov2740_check_hwcfg(struct device *dev)
>  	if (ret)
>  		return ret;
> 
> -	if (mclk != OV2740_MCLK) {
> -		dev_err(dev, "external clock %d is not supported", mclk);
> -		return -EINVAL;
> -	}
> +	if (mclk != OV2740_MCLK)
> +		return dev_err_probe(dev, -EINVAL,
> +				     "external clock %d is not supported\n",
> +				     mclk);
> 
>  	ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
>  	if (!ep)
> @@ -1028,15 +1028,14 @@ static int ov2740_check_hwcfg(struct device *dev)
>  		return ret;
> 
>  	if (bus_cfg.bus.mipi_csi2.num_data_lanes != OV2740_DATA_LANES) {
> -		dev_err(dev, "number of CSI2 data lanes %d is not supported",
> -			bus_cfg.bus.mipi_csi2.num_data_lanes);
> -		ret = -EINVAL;
> +		ret = dev_err_probe(dev, -EINVAL,
> +				    "number of CSI2 data lanes %d is not
> supported\n",
> +				    bus_cfg.bus.mipi_csi2.num_data_lanes);
>  		goto check_hwcfg_error;
>  	}
> 
>  	if (!bus_cfg.nr_of_link_frequencies) {
> -		dev_err(dev, "no link frequencies defined");
> -		ret = -EINVAL;
> +		ret = dev_err_probe(dev, -EINVAL, "no link frequencies
> defined\n");
>  		goto check_hwcfg_error;
>  	}
> 
> @@ -1048,9 +1047,9 @@ static int ov2740_check_hwcfg(struct device *dev)
>  		}
> 
>  		if (j == bus_cfg.nr_of_link_frequencies) {
> -			dev_err(dev, "no link frequency %lld supported",
> -				link_freq_menu_items[i]);
> -			ret = -EINVAL;
> +			ret = dev_err_probe(dev, -EINVAL,
> +					    "no link frequency %lld supported\n",
> +					    link_freq_menu_items[i]);
>  			goto check_hwcfg_error;
>  		}
>  	}
> @@ -1153,16 +1152,14 @@ static int ov2740_register_nvmem(struct i2c_client
> *client,
> 
>  static int ov2740_probe(struct i2c_client *client)  {
> +	struct device *dev = &client->dev;
>  	struct ov2740 *ov2740;
>  	bool full_power;
>  	int ret;
> 
>  	ret = ov2740_check_hwcfg(&client->dev);
> -	if (ret) {
> -		dev_err(&client->dev, "failed to check HW configuration: %d",
> -			ret);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to check HW
> configuration\n");
> 
>  	ov2740 = devm_kzalloc(&client->dev, sizeof(*ov2740), GFP_KERNEL);
>  	if (!ov2740)
> @@ -1172,17 +1169,15 @@ static int ov2740_probe(struct i2c_client *client)
>  	full_power = acpi_dev_state_d0(&client->dev);
>  	if (full_power) {
>  		ret = ov2740_identify_module(ov2740);
> -		if (ret) {
> -			dev_err(&client->dev, "failed to find sensor: %d",
> ret);
> -			return ret;
> -		}
> +		if (ret)
> +			return dev_err_probe(dev, ret, "failed to find
> sensor\n");
>  	}
> 
>  	mutex_init(&ov2740->mutex);
>  	ov2740->cur_mode = &supported_modes[0];
>  	ret = ov2740_init_controls(ov2740);
>  	if (ret) {
> -		dev_err(&client->dev, "failed to init controls: %d", ret);
> +		dev_err_probe(dev, ret, "failed to init controls\n");
>  		goto probe_error_v4l2_ctrl_handler_free;
>  	}
> 
> @@ -1193,14 +1188,13 @@ static int ov2740_probe(struct i2c_client *client)
>  	ov2740->pad.flags = MEDIA_PAD_FL_SOURCE;
>  	ret = media_entity_pads_init(&ov2740->sd.entity, 1, &ov2740->pad);
>  	if (ret) {
> -		dev_err(&client->dev, "failed to init entity pads: %d", ret);
> +		dev_err_probe(dev, ret, "failed to init entity pads\n");
>  		goto probe_error_v4l2_ctrl_handler_free;
>  	}
> 
>  	ret = v4l2_async_register_subdev_sensor(&ov2740->sd);
>  	if (ret < 0) {
> -		dev_err(&client->dev, "failed to register V4L2 subdev: %d",
> -			ret);
> +		dev_err_probe(dev, ret, "failed to register V4L2 subdev\n");
>  		goto probe_error_media_entity_cleanup;
>  	}
> 
> --
> 2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ