@@ -97,18 +97,9 @@ static int optee_rtc_settime(struct device *dev, struct rtc_time *tm)
9797 struct optee_rtc * priv = dev_get_drvdata (dev );
9898 struct tee_ioctl_invoke_arg inv_arg = {0 };
9999 struct tee_param param [4 ] = {0 };
100- struct optee_rtc_time optee_tm ;
101- void * rtc_data ;
100+ struct optee_rtc_time * optee_tm ;
102101 int ret ;
103102
104- optee_tm .tm_sec = tm -> tm_sec ;
105- optee_tm .tm_min = tm -> tm_min ;
106- optee_tm .tm_hour = tm -> tm_hour ;
107- optee_tm .tm_mday = tm -> tm_mday ;
108- optee_tm .tm_mon = tm -> tm_mon ;
109- optee_tm .tm_year = tm -> tm_year + 1900 ;
110- optee_tm .tm_wday = tm -> tm_wday ;
111-
112103 inv_arg .func = TA_CMD_RTC_SET_TIME ;
113104 inv_arg .session = priv -> session_id ;
114105 inv_arg .num_params = 4 ;
@@ -117,11 +108,17 @@ static int optee_rtc_settime(struct device *dev, struct rtc_time *tm)
117108 param [0 ].u .memref .shm = priv -> shm ;
118109 param [0 ].u .memref .size = sizeof (struct optee_rtc_time );
119110
120- rtc_data = tee_shm_get_va (priv -> shm , 0 );
121- if (IS_ERR (rtc_data ))
122- return PTR_ERR (rtc_data );
111+ optee_tm = tee_shm_get_va (priv -> shm , 0 );
112+ if (IS_ERR (optee_tm ))
113+ return PTR_ERR (optee_tm );
123114
124- memcpy (rtc_data , & optee_tm , sizeof (struct optee_rtc_time ));
115+ optee_tm -> tm_min = tm -> tm_min ;
116+ optee_tm -> tm_sec = tm -> tm_sec ;
117+ optee_tm -> tm_hour = tm -> tm_hour ;
118+ optee_tm -> tm_mday = tm -> tm_mday ;
119+ optee_tm -> tm_mon = tm -> tm_mon ;
120+ optee_tm -> tm_year = tm -> tm_year + 1900 ;
121+ optee_tm -> tm_wday = tm -> tm_wday ;
125122
126123 ret = tee_client_invoke_func (priv -> ctx , & inv_arg , param );
127124 if (ret < 0 || inv_arg .ret != 0 )
@@ -241,14 +238,12 @@ static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
241238static int optee_rtc_probe (struct device * dev )
242239{
243240 struct tee_client_device * rtc_device = to_tee_client_device (dev );
244- struct tee_ioctl_open_session_arg sess_arg ;
241+ struct tee_ioctl_open_session_arg sess_arg = { 0 } ;
245242 struct optee_rtc * priv ;
246243 struct rtc_device * rtc ;
247244 struct tee_shm * shm ;
248245 int ret , err ;
249246
250- memset (& sess_arg , 0 , sizeof (sess_arg ));
251-
252247 priv = devm_kzalloc (dev , sizeof (* priv ), GFP_KERNEL );
253248 if (!priv )
254249 return - ENOMEM ;
0 commit comments